aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2023-05-10 00:36:51 +0200
committerChristian Grothoff <christian@grothoff.org>2023-05-10 00:36:51 +0200
commit52b2f7414c77843cde56378772ad5b5ded56182d (patch)
tree9d4d72ac554252874e8d4eab051aa7d64ed0bfc5 /src
parentad12ba186b99150b0f2fce52fed550c337d22f2e (diff)
-fix zero-length VLAs
Diffstat (limited to 'src')
-rw-r--r--src/backenddb/pg_lookup_instances.c8
-rw-r--r--src/backenddb/test_merchantdb.c32
2 files changed, 22 insertions, 18 deletions
diff --git a/src/backenddb/pg_lookup_instances.c b/src/backenddb/pg_lookup_instances.c
index d876ad69..7dcbcb31 100644
--- a/src/backenddb/pg_lookup_instances.c
+++ b/src/backenddb/pg_lookup_instances.c
@@ -177,10 +177,10 @@ lookup_accounts_cb (void *cls,
unsigned int num_results)
{
struct LookupInstancesContext *lic = cls;
- char *paytos[num_results];
- char *facade_urls[num_results];
- json_t *credentials[num_results];
- struct TALER_MERCHANTDB_AccountDetails accounts[num_results];
+ char *paytos[GNUNET_NZL (num_results)];
+ char *facade_urls[GNUNET_NZL (num_results)];
+ json_t *credentials[GNUNET_NZL (num_results)];
+ struct TALER_MERCHANTDB_AccountDetails accounts[GNUNET_NZL (num_results)];
memset (facade_urls,
0,
diff --git a/src/backenddb/test_merchantdb.c b/src/backenddb/test_merchantdb.c
index c3a2d3ad..7708326c 100644
--- a/src/backenddb/test_merchantdb.c
+++ b/src/backenddb/test_merchantdb.c
@@ -302,7 +302,7 @@ lookup_instances_cb (void *cls,
/* Look through the closure and test each instance for equality */
for (unsigned int i = 0; cmp->instances_to_cmp_length > i; ++i)
{
- int accounts_matching[accounts_length];
+ int accounts_matching[GNUNET_NZL (accounts_length)];
bool accounts_match = true;
if (0 != check_instances_equal (cmp->instances_to_cmp[i].instance,
is))
@@ -436,9 +436,9 @@ test_delete_instance_private_key (const struct InstanceData *instance,
enum GNUNET_DB_QueryStatus expected_result)
{
TEST_COND_RET_ON_FAIL (expected_result ==
- plugin->delete_instance_private_key (plugin->cls,
- instance->instance
- .id),
+ plugin->delete_instance_private_key (
+ plugin->cls,
+ instance->instance.id),
"Delete instance private key failed\n");
return 0;
}
@@ -973,7 +973,7 @@ test_lookup_products (const struct InstanceData *instance,
unsigned int products_length,
const struct ProductData *products)
{
- unsigned int results_matching[products_length];
+ unsigned int results_matching[GNUNET_NZL (products_length)];
struct TestLookupProducts_Closure cls = {
.products_to_cmp_length = products_length,
.products_to_cmp = products,
@@ -1498,7 +1498,7 @@ test_lookup_orders (const struct InstanceData *instance,
unsigned int orders_length,
const struct OrderData *orders)
{
- bool results_match[orders_length];
+ bool results_match[GNUNET_NZL (orders_length)];
struct TestLookupOrders_Closure cls = {
.orders_to_cmp_length = orders_length,
.orders_to_cmp = orders,
@@ -2688,7 +2688,7 @@ test_lookup_deposits (const struct InstanceData *instance,
unsigned int deposits_length,
const struct DepositData *deposits)
{
- unsigned int results_matching[deposits_length];
+ unsigned int results_matching[GNUNET_NZL (deposits_length)];
struct TestLookupDeposits_Closure cmp = {
.deposits_to_cmp_length = deposits_length,
.deposits_to_cmp = deposits,
@@ -4533,7 +4533,7 @@ lookup_reserve_cb (void *cls,
const struct TALER_MERCHANTDB_TipDetails *tips)
{
struct TestLookupReserve_Closure *cmp = cls;
- unsigned int tip_cmp_results[tips_length];
+ unsigned int tip_cmp_results[GNUNET_NZL (tips_length)];
if (NULL == cmp)
return;
@@ -4811,7 +4811,7 @@ static int
test_lookup_pending_reserves (unsigned int reserves_length,
const struct ReserveData *reserves)
{
- unsigned int results_matching[reserves_length];
+ unsigned int results_matching[GNUNET_NZL (reserves_length)];
struct TestLookupReserves_Closure cmp = {
.reserves_to_cmp_length = reserves_length,
.reserves_to_cmp = reserves,
@@ -5008,7 +5008,7 @@ test_lookup_tip_details (
struct TALER_ReservePublicKeyP reserve_pub;
unsigned int pickups_length;
struct TALER_MERCHANTDB_PickupDetails *pickups = NULL;
- unsigned int results_matching[expected_pickups_length];
+ unsigned int results_matching[GNUNET_NZL (expected_pickups_length)];
if (0 >
plugin->lookup_tip_details (plugin->cls,
@@ -5128,8 +5128,9 @@ test_lookup_pickup (
{
char *exchange_url = NULL;
struct TALER_ReservePrivateKeyP reserve_priv;
- struct TALER_BlindedDenominationSignature sigs[expected_sigs_length];
- unsigned int results_matching[expected_sigs_length];
+ struct TALER_BlindedDenominationSignature sigs[GNUNET_NZL (
+ expected_sigs_length)];
+ unsigned int results_matching[GNUNET_NZL (expected_sigs_length)];
memset (sigs,
0,
@@ -8177,14 +8178,17 @@ test_lookup_all_webhooks (const struct InstanceData *instance,
{
uint64_t max_results = 2;
uint64_t min_row = 0;
- unsigned int results_matching[pwebhooks_length];
+ unsigned int results_matching[GNUNET_NZL (pwebhooks_length)];
struct TestLookupPendingWebhooks_Closure cls = {
.webhooks_to_cmp_length = pwebhooks_length,
.webhooks_to_cmp = pwebhooks,
.results_matching = results_matching,
.results_length = 0
};
- memset (results_matching, 0, sizeof (unsigned int) * pwebhooks_length);
+
+ memset (results_matching,
+ 0,
+ sizeof (results_matching));
if (0 > plugin->lookup_all_webhooks (plugin->cls,
instance->instance.id,
min_row,