gnunet-svn
[Top][All Lists]
Advanced

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

[libmicrohttpd] branch master updated (8b01c152 -> 2de47d20)


From: gnunet
Subject: [libmicrohttpd] branch master updated (8b01c152 -> 2de47d20)
Date: Thu, 23 Jun 2022 10:39:46 +0200

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

karlson2k pushed a change to branch master
in repository libmicrohttpd.

    from 8b01c152 mhd_str.h: fixed doxy
     new 23d69214 digestauth: added check whether arguments specified in the 
right order
     new 2de47d20 digestauth: use size_t for counting headers

The 2 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/digestauth.c | 46 +++++++++++++++++++++++++++------------------
 1 file changed, 28 insertions(+), 18 deletions(-)

diff --git a/src/microhttpd/digestauth.c b/src/microhttpd/digestauth.c
index e6f68222..41a016df 100644
--- a/src/microhttpd/digestauth.c
+++ b/src/microhttpd/digestauth.c
@@ -1188,7 +1188,7 @@ calculate_add_nonce_with_retry (struct MHD_Connection 
*const connection,
 struct test_header_param
 {
   struct MHD_Connection *connection;
-  unsigned int num_headers;
+  size_t num_headers;
 };
 
 /**
@@ -1215,30 +1215,40 @@ test_header (void *cls,
   struct test_header_param *const param = (struct test_header_param *) cls;
   struct MHD_Connection *connection = param->connection;
   struct MHD_HTTP_Req_Header *pos;
+  size_t i;
 
   param->num_headers++;
+  i = 0;
   for (pos = connection->headers_received; NULL != pos; pos = pos->next)
   {
     if (kind != pos->kind)
       continue;
-    if (key_size != pos->header_size)
-      continue;
-    if (value_size != pos->value_size)
-      continue;
-    if (0 != memcmp (key,
-                     pos->header,
-                     key_size))
-      continue;
-    if ( (NULL == value) &&
-         (NULL == pos->value) )
+    if (++i == param->num_headers)
+    {
+      if (key_size != pos->header_size)
+        return MHD_NO;
+      if (value_size != pos->value_size)
+        return MHD_NO;
+      if (0 != key_size)
+      {
+        mhd_assert (NULL != key);
+        mhd_assert (NULL != pos->header);
+        if (0 != memcmp (key,
+                         pos->header,
+                         key_size))
+          return MHD_NO;
+      }
+      if (0 != value_size)
+      {
+        mhd_assert (NULL != value);
+        mhd_assert (NULL != pos->value);
+        if (0 != memcmp (value,
+                         pos->value,
+                         value_size))
+          return MHD_NO;
+      }
       return MHD_YES;
-    if ( (NULL == value) ||
-         (NULL == pos->value) ||
-         (0 != memcmp (value,
-                       pos->value,
-                       value_size)) )
-      continue;
-    return MHD_YES;
+    }
   }
   return MHD_NO;
 }

-- 
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]