[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-exchange] 01/02: -add sanity check
From: |
gnunet |
Subject: |
[taler-exchange] 01/02: -add sanity check |
Date: |
Fri, 13 Oct 2023 08:50:29 +0200 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository exchange.
commit c55be23e812f4add56711e1589d7aa5c9474917c
Author: Christian Grothoff <grothoff@gnunet.org>
AuthorDate: Fri Oct 13 08:41:25 2023 +0200
-add sanity check
---
src/util/config.c | 33 +++++++++++++++++++++++++++++++--
1 file changed, 31 insertions(+), 2 deletions(-)
diff --git a/src/util/config.c b/src/util/config.c
index f00d11ba..d3804022 100644
--- a/src/util/config.c
+++ b/src/util/config.c
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2014-2020 Taler Systems SA
+ Copyright (C) 2014-2023 Taler Systems SA
TALER is free software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
@@ -392,7 +392,36 @@ parse_currencies_cb (void *cls,
return;
}
}
- /* FIXME: validate map only maps from decimal numbers to strings! */
+
+ {
+ /* validate map only maps from decimal numbers to strings! */
+ const char *str;
+ json_t *val;
+
+ json_object_foreach (cspec->map_alt_unit_names, str, val)
+ {
+ int idx;
+ char dummy;
+
+ if ( (1 != sscanf (str,
+ "%d%c",
+ &idx,
+ &dummy)) ||
+ (idx < -12) ||
+ (idx > 24) ||
+ (! json_is_string (val) ) )
+ {
+ GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
+ section,
+ "ALT_UNIT_NAMES",
+ "invalid map entry detected");
+ cpc->failure = true;
+ json_decref (cspec->map_alt_unit_names);
+ cspec->map_alt_unit_names = NULL;
+ return;
+ }
+ }
+ }
}
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.