]> granicus.if.org Git - neomutt/commitdiff
bug: prevent unterminated string
authorRichard Russon <rich@flatcap.org>
Sat, 1 Jun 2019 10:43:35 +0000 (11:43 +0100)
committerRichard Russon <rich@flatcap.org>
Sat, 1 Jun 2019 23:06:22 +0000 (00:06 +0100)
Coverity: CID 83483

conn/ssl_gnutls.c

index 545da9c81865f5bd353977d0e9a6b1769cad5d90..e920342186c3ce34739bac461dded394be5375e6 100644 (file)
@@ -256,9 +256,8 @@ static int tls_compare_certificates(const gnutls_datum_t *peercert)
   if (stat(C_CertificateFile, &filestat) == -1)
     return 0;
 
-  b64_data.size = filestat.st_size + 1;
-  b64_data_data = mutt_mem_calloc(1, b64_data.size);
-  b64_data_data[b64_data.size - 1] = '\0';
+  b64_data.size = filestat.st_size;
+  b64_data_data = mutt_mem_calloc(1, b64_data.size + 1);
   b64_data.data = b64_data_data;
 
   FILE *fp = fopen(C_CertificateFile, "r");