gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r19546 - in libmicrohttpd: . src/daemon src/include
Date: Mon, 30 Jan 2012 20:03:16 +0100

Author: grothoff
Date: 2012-01-30 20:03:16 +0100 (Mon, 30 Jan 2012)
New Revision: 19546

Modified:
   libmicrohttpd/ChangeLog
   libmicrohttpd/src/daemon/postprocessor.c
   libmicrohttpd/src/include/microhttpd.h
Log:
fixing #2126

Modified: libmicrohttpd/ChangeLog
===================================================================
--- libmicrohttpd/ChangeLog     2012-01-30 18:52:54 UTC (rev 19545)
+++ libmicrohttpd/ChangeLog     2012-01-30 19:03:16 UTC (rev 19546)
@@ -1,3 +1,7 @@
+Mon Jan 30 20:02:34 CET 2012
+       Fixed handling of garbage prior to first multipart boundary
+       (#2126). -woof
+
 Fri Jan 27 11:00:43 CET 2012
        Fixed postprocessor failure for applications that enclosed boundary
        in quotes (#2120). -woof

Modified: libmicrohttpd/src/daemon/postprocessor.c
===================================================================
--- libmicrohttpd/src/daemon/postprocessor.c    2012-01-30 18:52:54 UTC (rev 
19545)
+++ libmicrohttpd/src/daemon/postprocessor.c    2012-01-30 19:03:16 UTC (rev 
19546)
@@ -39,6 +39,7 @@
   PP_Error,
   PP_Done,
   PP_Init,
+  PP_NextBoundary,
 
   /* url encoding-states */
   PP_ProcessValue,
@@ -492,7 +493,8 @@
     }
   if ((0 != memcmp ("--", buf, 2)) || (0 != memcmp (&buf[2], boundary, blen)))
     {
-      pp->state = PP_Error;
+      if (pp->state != PP_Init)
+        pp->state = PP_Error;
       return MHD_NO;            /* expected boundary */
     }
   /* remove boundary from buffer */
@@ -823,11 +825,30 @@
           pp->state = PP_Error;
           return MHD_NO;
         case PP_Init:
+          /**
+           * Per RFC2046 5.1.1 NOTE TO IMPLEMENTORS, consume anything
+           * prior to the first multipart boundary:
+           *
+           * > There appears to be room for additional information prior
+           * > to the first boundary delimiter line and following the
+           * > final boundary delimiter line.  These areas should
+           * > generally be left blank, and implementations must ignore
+           * > anything that appears before the first boundary delimiter
+           * > line or after the last one.
+           */
           if (MHD_NO == find_boundary (pp,
                                        pp->boundary,
                                        pp->blen,
                                        &ioff,
                                        PP_ProcessEntryHeaders, PP_Done))
+            ++ioff;
+          break;
+        case PP_NextBoundary:
+          if (MHD_NO == find_boundary (pp,
+                                       pp->boundary,
+                                       pp->blen,
+                                       &ioff,
+                                       PP_ProcessEntryHeaders, PP_Done))
             {
               if (pp->state == PP_Error)
                 return MHD_NO;
@@ -914,7 +935,7 @@
                                        pp->nlen,
                                        &ioff,
                                        PP_Nested_PerformMarking,
-                                       PP_Init /* or PP_Error? */ ))
+                                       PP_NextBoundary /* or PP_Error? */ ))
             {
               if (pp->state == PP_Error)
                 return MHD_NO;
@@ -955,7 +976,7 @@
                                                    pp->nested_boundary,
                                                    pp->nlen,
                                                    PP_Nested_PerformCleanup,
-                                                   PP_Init))
+                                                   PP_NextBoundary))
             {
               if (pp->state == PP_Error)
                 return MHD_NO;

Modified: libmicrohttpd/src/include/microhttpd.h
===================================================================
--- libmicrohttpd/src/include/microhttpd.h      2012-01-30 18:52:54 UTC (rev 
19545)
+++ libmicrohttpd/src/include/microhttpd.h      2012-01-30 19:03:16 UTC (rev 
19546)
@@ -106,7 +106,7 @@
 /**
  * Current version of the library.
  */
-#define MHD_VERSION 0x00091200
+#define MHD_VERSION 0x00091201
 
 /**
  * MHD-internal return code for "YES".




reply via email to

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