aboutsummaryrefslogtreecommitdiff
path: root/src/util/strings.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2022-01-12 20:30:37 +0100
committerChristian Grothoff <christian@grothoff.org>2022-02-19 12:39:55 +0100
commitaf252f5c3d4e62f4db39bbc65f3eea4f853d04bc (patch)
tree616629ee96494f49469162563ee6c90424c871e9 /src/util/strings.c
parent3e3081cfd22f5dacbeaba2843131c4aec530b562 (diff)
downloadgnunet-af252f5c3d4e62f4db39bbc65f3eea4f853d04bc.tar.gz
gnunet-af252f5c3d4e62f4db39bbc65f3eea4f853d04bc.zip
-conclude hello-uri implementation and test
Diffstat (limited to 'src/util/strings.c')
-rw-r--r--src/util/strings.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/util/strings.c b/src/util/strings.c
index a77f09022..7e218cc59 100644
--- a/src/util/strings.c
+++ b/src/util/strings.c
@@ -1813,12 +1813,19 @@ GNUNET_STRINGS_urldecode (const char *data,
1813 char *wpos = *out; 1813 char *wpos = *out;
1814 size_t resl = 0; 1814 size_t resl = 0;
1815 1815
1816 while ('\0' != *rpos) 1816 while ( ('\0' != *rpos) &&
1817 (data + len != rpos) )
1817 { 1818 {
1818 unsigned int num; 1819 unsigned int num;
1819 switch (*rpos) 1820 switch (*rpos)
1820 { 1821 {
1821 case '%': 1822 case '%':
1823 if (rpos + 3 > data + len)
1824 {
1825 GNUNET_break_op (0);
1826 GNUNET_free (*out);
1827 return 0;
1828 }
1822 if (1 != sscanf (rpos + 1, "%2x", &num)) 1829 if (1 != sscanf (rpos + 1, "%2x", &num))
1823 break; 1830 break;
1824 *wpos = (char) ((unsigned char) num); 1831 *wpos = (char) ((unsigned char) num);