libmicrohttpd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libmicrohttpd] [PATCH] doc/examples: tlsauthentication: fix out-of-boun


From: Fabian Mewes
Subject: [libmicrohttpd] [PATCH] doc/examples: tlsauthentication: fix out-of-bound read
Date: Sun, 28 Feb 2016 01:52:48 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

Fix the out-of-bound read of the NUL byte using strlen() in
microhttpd/daemon.c:MHD_init_daemon_certificate()

Index: doc/examples/tlsauthentication.c
===================================================================
--- doc/examples/tlsauthentication.c    (revision 36918)
+++ doc/examples/tlsauthentication.c    (working copy)
@@ -98,7 +98,7 @@
   if (!fp)
     return NULL;

-  buffer = malloc (size);
+  buffer = malloc (size + 1);
   if (!buffer)
     {
       fclose (fp);
@@ -110,6 +110,7 @@
       free (buffer);
       buffer = NULL;
     }
+  buffer[size] = '\0';

   fclose (fp);
   return buffer;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]