gnunet-svn
[Top][All Lists]
Advanced

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

[libmicrohttpd] branch master updated (f032145e -> bbc57f93)


From: gnunet
Subject: [libmicrohttpd] branch master updated (f032145e -> bbc57f93)
Date: Wed, 15 Sep 2021 12:51:20 +0200

This is an automated email from the git hooks/post-receive script.

karlson2k pushed a change to branch master
in repository libmicrohttpd.

    from f032145e test_postprocessor: added check with empty key
     new 368991b0 postprocessor: do not try to process value or key if state is 
'error'
     new ba63b33a postprocessor: added asserts
     new bbc57f93 postprocessor: fixed empty key processing

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/microhttpd/postprocessor.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/src/microhttpd/postprocessor.c b/src/microhttpd/postprocessor.c
index 334611ae..6f1d07e2 100644
--- a/src/microhttpd/postprocessor.c
+++ b/src/microhttpd/postprocessor.c
@@ -521,6 +521,12 @@ post_process_urlencoded (struct MHD_PostProcessor *pp,
       case '=':
         /* Case: 'key=' */
         end_key = &post_data[poff];
+        if ((start_key == end_key) && (0 == pp->buffer_pos))
+        {
+          /* Empty key with value */
+          pp->state = PP_Error;
+          continue;
+        }
         poff++;
         pp->state = PP_ProcessValue;
         break;
@@ -530,6 +536,12 @@ post_process_urlencoded (struct MHD_PostProcessor *pp,
         mhd_assert (NULL == start_value);
         mhd_assert (NULL == end_value);
         poff++;
+        if ((start_key == end_key) && (0 == pp->buffer_pos))
+        {
+          /* Empty key without value */
+          start_key = NULL;
+          continue;
+        }
         pp->state = PP_Callback;
         break;
       case '\n':
@@ -618,6 +630,7 @@ post_process_urlencoded (struct MHD_PostProcessor *pp,
       pp->state = PP_Error;
       break;
     case PP_Callback:
+      mhd_assert ((NULL != end_key) || (NULL == start_key));
       if ( (pp->buffer_pos + (end_key - start_key) >=
             pp->buffer_size) ||
            (pp->buffer_pos + (end_key - start_key) <
@@ -665,9 +678,16 @@ post_process_urlencoded (struct MHD_PostProcessor *pp,
     }
   }
 
+  if (PP_Error == pp->state)
+  {
+    /* State in error, returning failure */
+    return MHD_NO;
+  }
+
   /* save remaining data for next iteration */
   if (NULL != start_key)
   {
+    mhd_assert ((PP_Init == pp->state) || (NULL != end_key));
     if (NULL == end_key)
       end_key = &post_data[poff];
     if (pp->buffer_pos + (end_key - start_key) >= pp->buffer_size)

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

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