]> git.baikalelectronics.ru Git - arm-tf.git/commitdiff
fix(auth): reject junk after certificates
authorDemi Marie Obenour <demiobenour@gmail.com>
Thu, 8 Dec 2022 20:24:31 +0000 (15:24 -0500)
committerSandrine Bailleux <sandrine.bailleux@arm.com>
Tue, 3 Jan 2023 16:49:16 +0000 (17:49 +0100)
Certificates must not allow trailing junk after them.

Change-Id: Ie33205fb051fc63af5b72c326822da7f62eec1d1
Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
drivers/auth/mbedtls/mbedtls_x509_parser.c

index 87f280c133ca7671c24730cebfc1268fe1ec3bd5..d8f201e986f18487ba407a1080dea8e935436f04 100644 (file)
@@ -178,7 +178,7 @@ static int cert_parse(void *img, unsigned int img_len)
                return IMG_PARSER_ERR_FORMAT;
        }
 
-       if (len > (size_t)(end - p)) {
+       if (len != (size_t)(end - p)) {
                return IMG_PARSER_ERR_FORMAT;
        }
        crt_end = p + len;