gnunet-svn
[Top][All Lists]
Advanced

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

[gnunet] branch master updated: UTIL: fix infinite loop on malformed inp


From: gnunet
Subject: [gnunet] branch master updated: UTIL: fix infinite loop on malformed input to URL decoder
Date: Wed, 01 May 2024 09:33:44 +0200

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

grothoff pushed a commit to branch master
in repository gnunet.

The following commit(s) were added to refs/heads/master by this push:
     new c204ebe59 UTIL: fix infinite loop on malformed input to URL decoder
c204ebe59 is described below

commit c204ebe592ca6dd9b423f244f8f6d46c86e03a79
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Wed May 1 09:31:40 2024 +0200

    UTIL: fix infinite loop on malformed input to URL decoder
---
 contrib/gana             |  2 +-
 contrib/handbook         |  2 +-
 po/POTFILES.in           |  1 +
 src/lib/util/Makefile.am |  2 +-
 src/lib/util/strings.c   | 30 +++++++++++++++++++-----------
 5 files changed, 23 insertions(+), 14 deletions(-)

diff --git a/contrib/gana b/contrib/gana
index 53d099289..cc2d9bdb3 160000
--- a/contrib/gana
+++ b/contrib/gana
@@ -1 +1 @@
-Subproject commit 53d0992890e1ebb8f8c6bd747533abe157baec66
+Subproject commit cc2d9bdb3e90af5ddebf964e3da492c04a307417
diff --git a/contrib/handbook b/contrib/handbook
index c309e4169..7d66dc169 160000
--- a/contrib/handbook
+++ b/contrib/handbook
@@ -1 +1 @@
-Subproject commit c309e416984fc76e4b39adcbd4e8a602d94b1987
+Subproject commit 7d66dc1695829f2511f8e8ecc227a64d73d1562e
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 8872ddca1..382232226 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -99,6 +99,7 @@ src/contrib/service/set/ibf_sim.c
 src/contrib/service/set/plugin_block_set_test.c
 src/contrib/service/set/set_api.c
 src/contrib/service/template/gnunet-service-template.c
+src/gana/gnunet-error-codes/gnunet_error_codes.c
 src/lib/block/bg_bf.c
 src/lib/block/block.c
 src/lib/curl/curl.c
diff --git a/src/lib/util/Makefile.am b/src/lib/util/Makefile.am
index 00538847b..4d052c57b 100644
--- a/src/lib/util/Makefile.am
+++ b/src/lib/util/Makefile.am
@@ -147,7 +147,7 @@ libgnunetutil_la_LIBADD = \
 
 libgnunetutil_la_LDFLAGS = \
   $(GN_LIB_LDFLAGS) \
-  -version-info 16:0:0
+  -version-info 16:1:0
 
 lib_LTLIBRARIES = libgnunetutil.la
 
diff --git a/src/lib/util/strings.c b/src/lib/util/strings.c
index fe7a030dd..dc9fd0daf 100644
--- a/src/lib/util/strings.c
+++ b/src/lib/util/strings.c
@@ -37,7 +37,7 @@
 #define LOG(kind, ...) GNUNET_log_from (kind, "util-strings", __VA_ARGS__)
 
 #define LOG_STRERROR(kind, syscall) \
-  GNUNET_log_from_strerror (kind, "util-strings", syscall)
+        GNUNET_log_from_strerror (kind, "util-strings", syscall)
 
 
 size_t
@@ -1699,7 +1699,7 @@ GNUNET_STRINGS_base64url_encode (const void *in,
 
 
 #define cvtfind(a)                        \
-  ((((a) >= 'A') && ((a) <= 'Z'))         \
+        ((((a) >= 'A') && ((a) <= 'Z'))         \
    ? (a) - 'A'                          \
    : (((a) >= 'a') && ((a) <= 'z'))     \
    ? (a) - 'a' + 26                 \
@@ -1709,15 +1709,15 @@ GNUNET_STRINGS_base64url_encode (const void *in,
 
 
 #define CHECK_CRLF                                                \
-  while ( (data[i] == '\r') || (data[i] == '\n') )                \
-  {                                                               \
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK, \
-                "ignoring CR/LF\n");                              \
-    i++;                                                          \
-    if (i >= len) {                                               \
-      goto END;                                                   \
-    }                                                             \
-  }
+        while ( (data[i] == '\r') || (data[i] == '\n') )                \
+        {                                                               \
+          GNUNET_log (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK, \
+                      "ignoring CR/LF\n");                              \
+          i++;                                                          \
+          if (i >= len) {                                               \
+            goto END;                                                   \
+          }                                                             \
+        }
 
 
 size_t
@@ -1853,7 +1853,15 @@ GNUNET_STRINGS_urldecode (const char *data,
       if (1 != sscanf (rpos + 1,
                        "%2x",
                        &num))
+      {
+        /* Invalid URL encoding, try to continue anyway */
+        GNUNET_break_op (0);
+        *wpos = *rpos;
+        wpos++;
+        resl++;
+        rpos++;
         break;
+      }
       *wpos = (char) ((unsigned char) num);
       wpos++;
       resl++;

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