diff options
author | Christian Grothoff <christian@grothoff.org> | 2021-07-18 14:46:10 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2021-07-18 14:46:10 +0200 |
commit | 558a889bc8609ef99774b927a9b4ba780b3cbb1d (patch) | |
tree | 7641c1edef4a7868f56d70264be73164df1a2a74 /src/util | |
parent | c88b585cfd93e2ba517b2b1a53375d9795c171e2 (diff) | |
download | gnunet-558a889bc8609ef99774b927a9b4ba780b3cbb1d.tar.gz gnunet-558a889bc8609ef99774b927a9b4ba780b3cbb1d.zip |
-handle corner cases in JSON parser, lift 1kb restriction
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/gnunet-base32.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/util/gnunet-base32.c b/src/util/gnunet-base32.c index 2c797f56e..217185ed0 100644 --- a/src/util/gnunet-base32.c +++ b/src/util/gnunet-base32.c | |||
@@ -42,7 +42,8 @@ main (int argc, | |||
42 | const struct GNUNET_GETOPT_CommandLineOption options[] = { | 42 | const struct GNUNET_GETOPT_CommandLineOption options[] = { |
43 | GNUNET_GETOPT_option_flag ('d', | 43 | GNUNET_GETOPT_option_flag ('d', |
44 | "decode", | 44 | "decode", |
45 | gettext_noop ("run decoder modus, otherwise runs as encoder"), | 45 | gettext_noop ( |
46 | "run decoder modus, otherwise runs as encoder"), | ||
46 | &decode), | 47 | &decode), |
47 | GNUNET_GETOPT_option_help ("Crockford base32 encoder/decoder"), | 48 | GNUNET_GETOPT_option_help ("Crockford base32 encoder/decoder"), |
48 | GNUNET_GETOPT_option_version (PACKAGE_VERSION), | 49 | GNUNET_GETOPT_option_version (PACKAGE_VERSION), |
@@ -105,11 +106,12 @@ main (int argc, | |||
105 | out_size and out_size-1 below */ | 106 | out_size and out_size-1 below */ |
106 | out_size = in_size * 5 / 8; | 107 | out_size = in_size * 5 / 8; |
107 | out = GNUNET_malloc (out_size); | 108 | out = GNUNET_malloc (out_size); |
108 | if (GNUNET_OK != | 109 | if ( (GNUNET_OK != |
109 | GNUNET_STRINGS_string_to_data (in, | 110 | GNUNET_STRINGS_string_to_data (in, |
110 | in_size, | 111 | in_size, |
111 | out, | 112 | out, |
112 | out_size)) | 113 | out_size)) && |
114 | (out_size > 0) ) | ||
113 | { | 115 | { |
114 | out_size--; | 116 | out_size--; |
115 | if (GNUNET_OK != | 117 | if (GNUNET_OK != |