gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r5511 - in libmicrohttpd: . src/daemon


From: gnunet
Subject: [GNUnet-SVN] r5511 - in libmicrohttpd: . src/daemon
Date: Sat, 18 Aug 2007 03:07:12 -0600 (MDT)

Author: grothoff
Date: 2007-08-18 03:07:12 -0600 (Sat, 18 Aug 2007)
New Revision: 5511

Modified:
   libmicrohttpd/ChangeLog
   libmicrohttpd/src/daemon/response.c
Log:
extra error checking

Modified: libmicrohttpd/ChangeLog
===================================================================
--- libmicrohttpd/ChangeLog     2007-08-18 08:35:21 UTC (rev 5510)
+++ libmicrohttpd/ChangeLog     2007-08-18 09:07:12 UTC (rev 5511)
@@ -1,3 +1,8 @@
+Sat Aug 18 03:06:09 MDT 2007
+        Check for out of memory when adding headers to
+        responses.  Check for NULL key when looking
+        for headers. - CG
+
 Wed Aug 15 01:46:44 MDT 2007
         Extending API to allow timeout of connections.
         Changed API (MHD_create_response_from_callback) to

Modified: libmicrohttpd/src/daemon/response.c
===================================================================
--- libmicrohttpd/src/daemon/response.c 2007-08-18 08:35:21 UTC (rev 5510)
+++ libmicrohttpd/src/daemon/response.c 2007-08-18 09:07:12 UTC (rev 5511)
@@ -50,8 +50,19 @@
       (NULL != strstr (content, "\r")) || (NULL != strstr (content, "\n")))
     return MHD_NO;
   hdr = malloc (sizeof (struct MHD_HTTP_Header));
+  if (hdr == NULL)
+    return MHD_NO;
   hdr->header = strdup (header);
+  if (hdr->header == NULL) {
+    free(hdr);
+    return MHD_NO;
+  }
   hdr->value = strdup (content);
+  if (hdr->value == NULL) {
+    free(hdr->header);
+    free(hdr);
+    return MHD_NO;
+  }
   hdr->kind = MHD_HEADER_KIND;
   hdr->next = response->first_header;
   response->first_header = hdr;
@@ -132,6 +143,9 @@
 MHD_get_response_header (struct MHD_Response *response, const char *key)
 {
   struct MHD_HTTP_Header *pos;
+
+  if (key == NULL)
+    return NULL;
   pos = response->first_header;
   while (pos != NULL)
     {





reply via email to

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