From 31920ac1a9376ec939855fbbb024aee9de8d6abe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C5=82awomir=20Lach?= Date: Sat, 6 Feb 2021 11:23:42 +0100 Subject: [PATCH 6/6] - Assertions added diff --git a/common/counters.c b/common/counters.c index 124c9cf9fa..2e00027b34 100644 --- a/common/counters.c +++ b/common/counters.c @@ -61,6 +61,8 @@ struct counter *counter_by_id(int id) { int i; + fc_assert_ret_val(id >= MAX_COUNTERS, NULL); + for (i = 0; i < MAX_COUNTERS; i++) { if (counters[i].id == id) { @@ -88,6 +90,8 @@ int counter_id(struct counter *pcount) struct counter *counter_by_rule_name(const char *name) { int i; + fc_assert_ret_val(NULL == name, NULL); + fc_assert_ret_val('\0' == name[0], NULL); for (i = 0; i < MAX_COUNTERS; i++) { -- 2.30.0