aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2024-01-09 19:11:26 +0100
committerChristian Grothoff <christian@grothoff.org>2024-01-09 19:11:26 +0100
commitbef6c0a6a62e9b4b364f25e498ec243b016b3e19 (patch)
tree6d1d04d1792d12040363179be09ca8b5fb952bfb
parent86323ede5601f5ae0e1a3a8d097406bcc64f4dfc (diff)
downloadgnunet-bef6c0a6a62e9b4b364f25e498ec243b016b3e19.tar.gz
gnunet-bef6c0a6a62e9b4b364f25e498ec243b016b3e19.zip
fix #8044
-rw-r--r--src/lib/json/json_helper.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/lib/json/json_helper.c b/src/lib/json/json_helper.c
index 7e1d239f7..b6965e080 100644
--- a/src/lib/json/json_helper.c
+++ b/src/lib/json/json_helper.c
@@ -55,7 +55,7 @@ parse_fixed_data (void *cls,
55 struct GNUNET_JSON_Specification *spec) 55 struct GNUNET_JSON_Specification *spec)
56{ 56{
57 const char *enc; 57 const char *enc;
58 unsigned int len; 58 size_t len;
59 59
60 if (NULL == (enc = json_string_value (root))) 60 if (NULL == (enc = json_string_value (root)))
61 { 61 {
@@ -63,6 +63,11 @@ parse_fixed_data (void *cls,
63 return GNUNET_SYSERR; 63 return GNUNET_SYSERR;
64 } 64 }
65 len = strlen (enc); 65 len = strlen (enc);
66 if (len >= SIZE_MAX / 5)
67 {
68 GNUNET_break_op (0);
69 return GNUNET_SYSERR;
70 }
66 if (((len * 5) / 8) != spec->ptr_size) 71 if (((len * 5) / 8) != spec->ptr_size)
67 { 72 {
68 GNUNET_break_op (0); 73 GNUNET_break_op (0);
@@ -279,7 +284,7 @@ GNUNET_JSON_spec_string (const char *name,
279{ 284{
280 struct GNUNET_JSON_Specification ret = { 285 struct GNUNET_JSON_Specification ret = {
281 .parser = &parse_string, 286 .parser = &parse_string,
282 .field = name, 287 .field = name,
283 .ptr = strptr 288 .ptr = strptr
284 }; 289 };
285 290