Skip to content

Commit

Permalink
netfilter: xt_helper: Use sizeof(variable) instead of literal number
Browse files Browse the repository at this point in the history
It's better to use sizeof(info->name)-1 as index to force set the string
tail instead of literal number '29'.

Signed-off-by: Gao Feng <fgao@ikuai8.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
  • Loading branch information
Gao Feng authored and Pablo Neira Ayuso committed Sep 23, 2016
1 parent 7bdc662 commit b9d80f8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/netfilter/xt_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ static int helper_mt_check(const struct xt_mtchk_param *par)
par->family);
return ret;
}
info->name[29] = '\0';
info->name[sizeof(info->name) - 1] = '\0';
return 0;
}

Expand Down

0 comments on commit b9d80f8

Please sign in to comment.