From 5b951875c455454da849caf7115212865e6c6533 Mon Sep 17 00:00:00 2001 From: Nikos Mavrogiannopoulos Date: Thu, 1 Dec 2016 16:19:31 +0100 Subject: certtool: prevent-null termination of buffers allocated with fread_file() We do not know whether their allocated size allows for that additional null, and we do not need the null termination. --- src/certtool.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/certtool.c b/src/certtool.c index f142d7667e..91c8ba3821 100644 --- a/src/certtool.c +++ b/src/certtool.c @@ -2609,8 +2609,6 @@ static void verify_chain(void) exit(1); } - buf[size] = 0; - _verify_x509_mem(buf, size, NULL, 0, 0, OPT_ARG(VERIFY_PURPOSE), OPT_ARG(VERIFY_HOSTNAME), OPT_ARG(VERIFY_EMAIL)); free(buf); @@ -2636,15 +2634,12 @@ static void verify_certificate(common_info_st * cinfo) exit(1); } - cert[cert_size] = 0; - cas = (void *) fread_file(ca_file, &ca_size); if (cas == NULL) { fprintf(stderr, "Error reading CA list"); exit(1); } - cas[ca_size] = 0; fclose(ca_file); } -- cgit v1.2.1