gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r6869 - libmicrohttpd/src/daemon


From: gnunet
Subject: [GNUnet-SVN] r6869 - libmicrohttpd/src/daemon
Date: Fri, 23 May 2008 16:49:29 -0600 (MDT)

Author: grothoff
Date: 2008-05-23 16:49:29 -0600 (Fri, 23 May 2008)
New Revision: 6869

Modified:
   libmicrohttpd/src/daemon/postprocessor.c
Log:
fixing issue with large urlencoded uploads

Modified: libmicrohttpd/src/daemon/postprocessor.c
===================================================================
--- libmicrohttpd/src/daemon/postprocessor.c    2008-05-23 05:07:57 UTC (rev 
6868)
+++ libmicrohttpd/src/daemon/postprocessor.c    2008-05-23 22:49:29 UTC (rev 
6869)
@@ -310,6 +310,7 @@
   unsigned int poff;
   unsigned int xoff;
   unsigned int delta;
+  int end_of_value_found;
   char *buf;
   char xbuf[XBUF_SIZE + 1];
 
@@ -355,11 +356,14 @@
           /* find last position in input buffer that is part of the value */
           amper = 0;
           while ((amper + poff < post_data_len) &&
+                (amper < XBUF_SIZE) && 
                  (post_data[amper + poff] != '&') &&
                  (post_data[amper + poff] != '\n') &&
                  (post_data[amper + poff] != '\r'))
             amper++;
-
+         end_of_value_found = ( (post_data[amper + poff] == '&') ||
+                                (post_data[amper + poff] == '\n') ||
+                                (post_data[amper + poff] == '\r') );
           /* compute delta, the maximum number of bytes that we will be able to
              process right now (either amper-limited of xbuf-size limited) */
           delta = amper;
@@ -400,12 +404,17 @@
           MHD_http_unescape (xbuf);
 
           /* finally: call application! */
-          pp->ikvi (pp->cls, MHD_POSTDATA_KIND, (const char *) &pp[1],  /* key 
*/
-                    NULL, NULL, NULL, xbuf, pp->value_offset, xoff);
+          if (MHD_NO ==
+             pp->ikvi (pp->cls, MHD_POSTDATA_KIND, (const char *) &pp[1],  /* 
key */
+                       NULL, NULL, NULL, xbuf, pp->value_offset, xoff))
+           {
+             pp->state = PP_Error;
+             return MHD_NO;
+           }
           pp->value_offset += xoff;
 
           /* are we done with the value? */
-          if (poff < post_data_len)
+          if (end_of_value_found)
             {
               /* we found the end of the value! */
               pp->state = PP_Init;





reply via email to

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