X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fiptables.c;h=225ed2c136d456096608b3847c5a314b1e949e28;hb=733fc645b6389d1f42aef8f1c1631f1db7d58196;hp=2dddacca2d84443966f2e0cf98a2eaf194b67631;hpb=0b7cd83a5e6bac068ea83a88a5ddcfb07c09fbec;p=collectd.git diff --git a/src/iptables.c b/src/iptables.c index 2dddacca..225ed2c1 100644 --- a/src/iptables.c +++ b/src/iptables.c @@ -86,8 +86,8 @@ typedef struct { char name[64]; } ip_chain_t; -static ip_chain_t **chain_list = NULL; -static int chain_num = 0; +static ip_chain_t **chain_list; +static int chain_num; static int iptables_config(const char *key, const char *value) { /* int ip_value; */ @@ -101,11 +101,9 @@ static int iptables_config(const char *key, const char *value) { return 1; ip_chain_t temp = {0}; - ip_chain_t * final, **list; + ip_chain_t *final, **list; char *table; - int table_len; char *chain; - int chain_len; char *value_copy; char *fields[4]; @@ -136,16 +134,16 @@ static int iptables_config(const char *key, const char *value) { table = fields[0]; chain = fields[1]; - table_len = strlen(table) + 1; - if ((unsigned int)table_len > sizeof(temp.table)) { + size_t table_len = strlen(table) + 1; + if (table_len > sizeof(temp.table)) { ERROR("Table `%s' too long.", table); free(value_copy); return 1; } sstrncpy(temp.table, table, table_len); - chain_len = strlen(chain) + 1; - if ((unsigned int)chain_len > sizeof(temp.chain)) { + size_t chain_len = strlen(chain) + 1; + if (chain_len > sizeof(temp.chain)) { ERROR("Chain `%s' too long.", chain); free(value_copy); return 1; @@ -187,7 +185,7 @@ static int iptables_config(const char *key, const char *value) { } chain_list = list; - final = malloc(sizeof(* final)); + final = malloc(sizeof(*final)); if (final == NULL) { ERROR("malloc failed: %s", STRERRNO); sfree(temp.rule.comment);