From 43ba03341b176cb71502df0ac7b979447b98fad9 Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Fri, 28 Nov 2008 00:45:03 +0100 Subject: conntrack: remove hardcoded buffer size, use sizeof instead This patch replaces a couple of hardcoded buffer sizes by sizeof() calls. This sort of code is error-prone. Signed-off-by: Pablo Neira Ayuso --- src/conntrack.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/conntrack.c') diff --git a/src/conntrack.c b/src/conntrack.c index 999df87..9d73631 100644 --- a/src/conntrack.c +++ b/src/conntrack.c @@ -759,7 +759,7 @@ static int delete_cb(enum nf_conntrack_msg_type type, if (output_mask & _O_ID) op_flags |= NFCT_OF_ID; - nfct_snprintf(buf, 1024, ct, NFCT_T_UNKNOWN, op_type, op_flags); + nfct_snprintf(buf, sizeof(buf), ct, NFCT_T_UNKNOWN, op_type, op_flags); printf("%s\n", buf); counter++; @@ -782,7 +782,7 @@ static int print_cb(enum nf_conntrack_msg_type type, if (output_mask & _O_ID) op_flags |= NFCT_OF_ID; - nfct_snprintf(buf, 1024, ct, NFCT_T_UNKNOWN, op_type, op_flags); + nfct_snprintf(buf, sizeof(buf), ct, NFCT_T_UNKNOWN, op_type, op_flags); printf("%s\n", buf); return NFCT_CB_CONTINUE; @@ -848,7 +848,7 @@ static int dump_exp_cb(enum nf_conntrack_msg_type type, { char buf[1024]; - nfexp_snprintf(buf, 1024, exp, NFCT_T_UNKNOWN, NFCT_O_DEFAULT, 0); + nfexp_snprintf(buf,sizeof(buf), exp, NFCT_T_UNKNOWN, NFCT_O_DEFAULT, 0); printf("%s\n", buf); counter++; -- cgit v1.2.3