From e2e549583543bb0d607670b25af75821f55d5538 Mon Sep 17 00:00:00 2001 From: Gary Ching-Pang Lin Date: Thu, 10 Apr 2014 12:36:29 +0800 Subject: [PATCH] Check corrupted key list Signed-off-by: Gary Ching-Pang Lin --- src/mokutil.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/mokutil.c b/src/mokutil.c index eb563ca..6792823 100644 --- a/src/mokutil.c +++ b/src/mokutil.c @@ -237,6 +237,14 @@ build_mok_list (void *data, unsigned long data_size, uint32_t *mok_num) unsigned long count = 0; while ((dbsize > 0) && (dbsize >= CertList->SignatureListSize)) { + if (CertList->SignatureListSize == 0 || + CertList->SignatureListSize <= CertList->SignatureSize) { + fprintf (stderr, "Corrupted signature list\n"); + if (list) + free (list); + return NULL; + } + if ((efi_guidcmp (CertList->SignatureType, EfiCertX509Guid) != 0) && (efi_guidcmp (CertList->SignatureType, EfiHashSha1Guid) != 0) && (efi_guidcmp (CertList->SignatureType, EfiHashSha224Guid) != 0) && -- 1.8.4.5