commit d3b17d3b19ad509e6e355677cc7fea73eb15c1b9
parent 601164fa3539f34369374788ad626b1c14e486be
Author: Christian Grothoff <christian@grothoff.org>
Date: Mon, 29 Feb 2016 12:27:57 +0000
-Fabian Mewes:
Fix the out-of-bound read of the NUL byte using strlen() in
microhttpd/daemon.c:MHD_init_daemon_certificate()
Fix the out-of-bound read of the NUL byte using strlen() in
microhttpd/daemon.c:MHD_init_daemon_certificate()
Diffstat:
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/doc/examples/tlsauthentication.c b/doc/examples/tlsauthentication.c
@@ -98,12 +98,13 @@ load_file (const char *filename)
if (!fp)
return NULL;
- buffer = malloc (size);
+ buffer = malloc (size + 1);
if (!buffer)
{
fclose (fp);
return NULL;
}
+ buffer[size] = '\0';
if (size != fread (buffer, 1, size, fp))
{