aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2024-03-01 12:32:32 +0100
committerChristian Grothoff <christian@grothoff.org>2024-03-01 12:32:32 +0100
commit08c15135e8d2489376918a29a1563f63dbf47bb2 (patch)
tree4ecfed52e192976f3f3628a9dde00ff4396c3d8d /src
parent505d220647baa740322a302f61ede31b129f26eb (diff)
downloadgnunet-08c15135e8d2489376918a29a1563f63dbf47bb2.tar.gz
gnunet-08c15135e8d2489376918a29a1563f63dbf47bb2.zip
fix #8050
Diffstat (limited to 'src')
-rw-r--r--src/lib/util/strings.c31
-rw-r--r--src/lib/util/test_regex.c6
2 files changed, 21 insertions, 16 deletions
diff --git a/src/lib/util/strings.c b/src/lib/util/strings.c
index 96cd4352a..412dfb53a 100644
--- a/src/lib/util/strings.c
+++ b/src/lib/util/strings.c
@@ -37,7 +37,7 @@
37#define LOG(kind, ...) GNUNET_log_from (kind, "util-strings", __VA_ARGS__) 37#define LOG(kind, ...) GNUNET_log_from (kind, "util-strings", __VA_ARGS__)
38 38
39#define LOG_STRERROR(kind, syscall) \ 39#define LOG_STRERROR(kind, syscall) \
40 GNUNET_log_from_strerror (kind, "util-strings", syscall) 40 GNUNET_log_from_strerror (kind, "util-strings", syscall)
41 41
42 42
43size_t 43size_t
@@ -1511,11 +1511,10 @@ GNUNET_STRINGS_parse_ipv6_policy (const char *routeListX)
1511 while (';' != routeList[pos]) 1511 while (';' != routeList[pos])
1512 pos++; 1512 pos++;
1513 slash = pos; 1513 slash = pos;
1514 while ( (slash >= start) && 1514 while ( (slash > start) &&
1515 (routeList[slash] != '/') ) 1515 (routeList[slash] != '/') )
1516 slash--; 1516 slash--;
1517 1517 if (slash <= start)
1518 if (slash < start)
1519 { 1518 {
1520 memset (&result[i].netmask, 1519 memset (&result[i].netmask,
1521 0xFF, 1520 0xFF,
@@ -1558,9 +1557,11 @@ GNUNET_STRINGS_parse_ipv6_policy (const char *routeListX)
1558 (bits > 128) ) 1557 (bits > 128) )
1559 { 1558 {
1560 if (0 == ret) 1559 if (0 == ret)
1560 {
1561 LOG (GNUNET_ERROR_TYPE_WARNING, 1561 LOG (GNUNET_ERROR_TYPE_WARNING,
1562 _ ("Wrong format `%s' for netmask\n"), 1562 _ ("Wrong format `%s' for netmask\n"),
1563 &routeList[slash + 1]); 1563 &routeList[slash]);
1564 }
1564 else 1565 else
1565 { 1566 {
1566 errno = save; 1567 errno = save;
@@ -1698,7 +1699,7 @@ GNUNET_STRINGS_base64url_encode (const void *in,
1698 1699
1699 1700
1700#define cvtfind(a) \ 1701#define cvtfind(a) \
1701 ((((a) >= 'A') && ((a) <= 'Z')) \ 1702 ((((a) >= 'A') && ((a) <= 'Z')) \
1702 ? (a) - 'A' \ 1703 ? (a) - 'A' \
1703 : (((a) >= 'a') && ((a) <= 'z')) \ 1704 : (((a) >= 'a') && ((a) <= 'z')) \
1704 ? (a) - 'a' + 26 \ 1705 ? (a) - 'a' + 26 \
@@ -1708,15 +1709,15 @@ GNUNET_STRINGS_base64url_encode (const void *in,
1708 1709
1709 1710
1710#define CHECK_CRLF \ 1711#define CHECK_CRLF \
1711 while ( (data[i] == '\r') || (data[i] == '\n') ) \ 1712 while ( (data[i] == '\r') || (data[i] == '\n') ) \
1712 { \ 1713 { \
1713 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK, \ 1714 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK, \
1714 "ignoring CR/LF\n"); \ 1715 "ignoring CR/LF\n"); \
1715 i++; \ 1716 i++; \
1716 if (i >= len) { \ 1717 if (i >= len) { \
1717 goto END; \ 1718 goto END; \
1718 } \ 1719 } \
1719 } 1720 }
1720 1721
1721 1722
1722size_t 1723size_t
diff --git a/src/lib/util/test_regex.c b/src/lib/util/test_regex.c
index 968828755..789418fa0 100644
--- a/src/lib/util/test_regex.c
+++ b/src/lib/util/test_regex.c
@@ -109,10 +109,14 @@ test_policy6toregex (const char *policy,
109 r = GNUNET_TUN_ipv6policy2regex (policy); 109 r = GNUNET_TUN_ipv6policy2regex (policy);
110 if (NULL == r) 110 if (NULL == r)
111 { 111 {
112 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
113 "Failed to parse `%s'\n",
114 policy);
112 GNUNET_break (0); 115 GNUNET_break (0);
113 return 1; 116 return 1;
114 } 117 }
115 if (0 != strcmp (regex, r)) 118 if (0 != strcmp (regex,
119 r))
116 { 120 {
117 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 121 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
118 "Expected: `%s' but got: `%s'\n", 122 "Expected: `%s' but got: `%s'\n",