summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Schanzenbach <mschanzenbach@posteo.de>2020-08-02 08:50:33 +0200
committerMartin Schanzenbach <mschanzenbach@posteo.de>2020-08-02 08:50:33 +0200
commit8ed78400d419a6a87df2596ed77849870494506c (patch)
treeaa03acebf0e89a70beb273102bc7d3bb1bcd2458
parentc0b4041cbd9d27ce919e861ca05a74843648d7d0 (diff)
- fix multibyte urlencode
-rw-r--r--src/util/strings.c2
-rw-r--r--src/util/test_strings.c4
2 files changed, 3 insertions, 3 deletions
diff --git a/src/util/strings.c b/src/util/strings.c
index d5e2f4878..9d6f4039e 100644
--- a/src/util/strings.c
+++ b/src/util/strings.c
@@ -2184,7 +2184,7 @@ GNUNET_STRINGS_urlencode (const char *data, size_t len, char **out)
if (0x80 + 0x40 + 0x20 == ((0x80 + 0x40 + 0x20 + 0x10) & *i8))
{
/* 3-byte value, percent-encode */
- for (unsigned int i = 0; i<4; i++)
+ for (unsigned int i = 0; i<3; i++)
{
GNUNET_buffer_write_fstr (&buf,
"%%%X%X",
diff --git a/src/util/test_strings.c b/src/util/test_strings.c
index 28b1bb6f8..753ec6908 100644
--- a/src/util/test_strings.c
+++ b/src/util/test_strings.c
@@ -39,9 +39,9 @@
#define WANTB(a, b, l) if (0 != memcmp (a, b, l)) { GNUNET_break (0); return 1; \
} else { }
-#define URLENCODE_TEST_VECTOR_PLAIN "Asbjlaw=ljsdlasjd?aslkdsa"
+#define URLENCODE_TEST_VECTOR_PLAIN "Asbjlaw=ljsdlasjd?人aslkdsa"
-#define URLENCODE_TEST_VECTOR_ENCODED "Asbjlaw\%3Dljsdlasjd\%3Faslkdsa"
+#define URLENCODE_TEST_VECTOR_ENCODED "Asbjlaw\%3Dljsdlasjd\%3F\%E4\%BA\%BAaslkdsa"
int
main (int argc, char *argv[])