summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2016-12-01 16:19:31 +0100
committerNikos Mavrogiannopoulos <nmav@redhat.com>2016-12-01 16:43:42 +0100
commit5b951875c455454da849caf7115212865e6c6533 (patch)
tree590abd3a77f19dd207bedbb6a07819b81a36d0cf
parent93486c97a9ba588e1b6eaec9918b7f4bf425d442 (diff)
downloadgnutls-5b951875c455454da849caf7115212865e6c6533.tar.gz
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.
-rw-r--r--src/certtool.c5
1 files changed, 0 insertions, 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);
}