aboutsummaryrefslogtreecommitdiff
path: root/src/json
diff options
context:
space:
mode:
authorChristian Grothoff <grothoff@gnunet.org>2023-10-13 08:50:25 +0200
committerChristian Grothoff <grothoff@gnunet.org>2023-10-13 08:50:25 +0200
commit4a8fb418d75b302ca578c5c1dec460ae9192112c (patch)
tree96f7a08b2b882bb0d20d44c9bd2cfc466cf5943f /src/json
parentc55be23e812f4add56711e1589d7aa5c9474917c (diff)
implement more sanity checks
Diffstat (limited to 'src/json')
-rw-r--r--src/json/json_helper.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/json/json_helper.c b/src/json/json_helper.c
index 99d8e5b50..6c960353d 100644
--- a/src/json/json_helper.c
+++ b/src/json/json_helper.c
@@ -192,6 +192,9 @@ parse_cspec (void *cls,
unsigned int eline;
(void) cls;
+ memset (r_cspec->currency,
+ 0,
+ sizeof (r_cspec->currency));
if (GNUNET_OK !=
GNUNET_JSON_parse (root,
gspec,
@@ -218,13 +221,20 @@ parse_cspec (void *cls,
GNUNET_break_op (0);
return GNUNET_SYSERR;
}
- memset (r_cspec->currency,
- 0,
- sizeof (r_cspec->currency));
- /* FIXME: check currency consists only of legal characters! */
+ if (GNUNET_OK !=
+ TALER_check_currency (currency))
+ {
+ GNUNET_break_op (0);
+ return GNUNET_SYSERR;
+ }
strcpy (r_cspec->currency,
currency);
- /* FIXME: check map is valid! */
+ if (GNUNET_OK !=
+ TALER_check_currency_scale_map (map))
+ {
+ GNUNET_break_op (0);
+ return GNUNET_SYSERR;
+ }
r_cspec->name = GNUNET_strdup (name);
r_cspec->decimal_separator = GNUNET_strdup (decimal_separator);
r_cspec->map_alt_unit_names = json_incref ((json_t *) map);