aboutsummaryrefslogtreecommitdiff
path: root/src/json/json_helper.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-07-18 14:46:10 +0200
committerChristian Grothoff <christian@grothoff.org>2021-07-18 14:46:10 +0200
commit558a889bc8609ef99774b927a9b4ba780b3cbb1d (patch)
tree7641c1edef4a7868f56d70264be73164df1a2a74 /src/json/json_helper.c
parentc88b585cfd93e2ba517b2b1a53375d9795c171e2 (diff)
downloadgnunet-558a889bc8609ef99774b927a9b4ba780b3cbb1d.tar.gz
gnunet-558a889bc8609ef99774b927a9b4ba780b3cbb1d.zip
-handle corner cases in JSON parser, lift 1kb restriction
Diffstat (limited to 'src/json/json_helper.c')
-rw-r--r--src/json/json_helper.c11
1 files changed, 10 insertions, 1 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,
125 return GNUNET_SYSERR; 125 return GNUNET_SYSERR;
126 } 126 }
127 size = (strlen (str) * 5) / 8; 127 size = (strlen (str) * 5) / 8;
128 if (size >= 1024) 128 if (size >= GNUNET_MAX_MALLOC_CHECKED)
129 { 129 {
130 GNUNET_break_op (0); 130 GNUNET_break_op (0);
131 return GNUNET_SYSERR; 131 return GNUNET_SYSERR;
@@ -135,6 +135,15 @@ parse_variable_data (void *cls,
135 strlen (str), 135 strlen (str),
136 data, 136 data,
137 size); 137 size);
138 if ( (0 < size) &&
139 (GNUNET_OK != res) )
140 {
141 size--;
142 res = GNUNET_STRINGS_string_to_data (str,
143 strlen (str),
144 data,
145 size);
146 }
138 if (GNUNET_OK != res) 147 if (GNUNET_OK != res)
139 { 148 {
140 GNUNET_break_op (0); 149 GNUNET_break_op (0);