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