[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet] branch master updated: -handle corner cases in JSON parser, li
From: |
gnunet |
Subject: |
[gnunet] branch master updated: -handle corner cases in JSON parser, lift 1kb restriction |
Date: |
Sun, 18 Jul 2021 14:49:23 +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 558a889bc -handle corner cases in JSON parser, lift 1kb restriction
558a889bc is described below
commit 558a889bc8609ef99774b927a9b4ba780b3cbb1d
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sun Jul 18 14:46:10 2021 +0200
-handle corner cases in JSON parser, lift 1kb restriction
---
src/json/json_helper.c | 11 ++++++++++-
src/util/gnunet-base32.c | 14 ++++++++------
2 files changed, 18 insertions(+), 7 deletions(-)
diff --git a/src/json/json_helper.c b/src/json/json_helper.c
index 6189b7596..03db9ec80 100644
--- a/src/json/json_helper.c
+++ b/src/json/json_helper.c
@@ -125,7 +125,7 @@ parse_variable_data (void *cls,
return GNUNET_SYSERR;
}
size = (strlen (str) * 5) / 8;
- if (size >= 1024)
+ if (size >= GNUNET_MAX_MALLOC_CHECKED)
{
GNUNET_break_op (0);
return GNUNET_SYSERR;
@@ -135,6 +135,15 @@ parse_variable_data (void *cls,
strlen (str),
data,
size);
+ if ( (0 < size) &&
+ (GNUNET_OK != res) )
+ {
+ size--;
+ res = GNUNET_STRINGS_string_to_data (str,
+ strlen (str),
+ data,
+ size);
+ }
if (GNUNET_OK != res)
{
GNUNET_break_op (0);
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,
const struct GNUNET_GETOPT_CommandLineOption options[] = {
GNUNET_GETOPT_option_flag ('d',
"decode",
- gettext_noop ("run decoder modus, otherwise
runs as encoder"),
+ gettext_noop (
+ "run decoder modus, otherwise runs as
encoder"),
&decode),
GNUNET_GETOPT_option_help ("Crockford base32 encoder/decoder"),
GNUNET_GETOPT_option_version (PACKAGE_VERSION),
@@ -105,11 +106,12 @@ main (int argc,
out_size and out_size-1 below */
out_size = in_size * 5 / 8;
out = GNUNET_malloc (out_size);
- if (GNUNET_OK !=
- GNUNET_STRINGS_string_to_data (in,
- in_size,
- out,
- out_size))
+ if ( (GNUNET_OK !=
+ GNUNET_STRINGS_string_to_data (in,
+ in_size,
+ out,
+ out_size)) &&
+ (out_size > 0) )
{
out_size--;
if (GNUNET_OK !=
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnunet] branch master updated: -handle corner cases in JSON parser, lift 1kb restriction,
gnunet <=