diff options
author | Christian Grothoff <christian@grothoff.org> | 2024-01-17 19:34:15 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2024-01-17 19:34:15 +0100 |
commit | 3db8ffe54274ee94cc6204463b6c425ba7bcebf7 (patch) | |
tree | 0ef7f989429341c64dd723f9df277a707f5197e6 | |
parent | 91969f18e4901d495331f2587e6424aad6b5216e (diff) | |
download | exchange-3db8ffe54274ee94cc6204463b6c425ba7bcebf7.tar.xz |
fix #8100
-rw-r--r-- | src/lib/exchange_api_common.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/lib/exchange_api_common.c b/src/lib/exchange_api_common.c index 239632656..417fdf357 100644 --- a/src/lib/exchange_api_common.c +++ b/src/lib/exchange_api_common.c @@ -414,18 +414,22 @@ parse_restrictions (const json_t *jresta, unsigned int *resta_len, struct TALER_EXCHANGE_AccountRestriction **resta) { + size_t alen; + if (! json_is_array (jresta)) { GNUNET_break_op (0); return GNUNET_SYSERR; } - *resta_len = json_array_size (jresta); - if (0 == *resta_len) + alen = json_array_size (jresta); + if (0 == alen) { /* no restrictions, perfectly OK */ *resta = NULL; return GNUNET_OK; } + *resta_len = (unsigned int) alen; + GNUNET_assert (alen == *resta_len); *resta = GNUNET_new_array (*resta_len, struct TALER_EXCHANGE_AccountRestriction); for (unsigned int i = 0; i<*resta_len; i++) |