>From 781183dbe41ca1146d60d2be41000af95f71f328 Mon Sep 17 00:00:00 2001 From: Peter Volkov Date: Sun, 17 Jul 2011 15:49:30 +0400 Subject: [PATCH 2/3] Avoid uninitialized variables Patch fixes following warnings: communication.c: In function 'ebt_deliver_counters': communication.c:290:24: warning: 'entries' may be used uninitialized in this function communication.c: In function 'ebt_get_table': communication.c:703:22: warning: 'u_e' may be used uninitialized in this function ebtables.c: In function 'do_command': ebtables.c:535:6: warning: 'chcounter' may be used uninitialized in this function extensions/ebt_among.c: In function 'parse': extensions/ebt_among.c:314:7: warning: 'flen' may be used uninitialized in this function extensions/ebt_among.c:315:6: warning: 'fd' may be used uninitialized in this function --- communication.c | 4 ++-- ebtables.c | 2 +- extensions/ebt_among.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/communication.c b/communication.c index 3311358..29d0f2c 100644 --- a/communication.c +++ b/communication.c @@ -293,7 +293,7 @@ void ebt_deliver_counters(struct ebt_u_replace *u_repl) socklen_t optlen; struct ebt_replace repl; struct ebt_cntchanges *cc = u_repl->cc->next, *cc2; - struct ebt_u_entries *entries; + struct ebt_u_entries *entries = NULL; struct ebt_u_entry *next = NULL; int i, chainnr = 0; @@ -708,7 +708,7 @@ int ebt_get_table(struct ebt_u_replace *u_repl, int init) { int i, j, k, hook; struct ebt_replace repl; - struct ebt_u_entry *u_e; + struct ebt_u_entry *u_e = NULL; struct ebt_cntchanges *new_cc, *cc; strcpy(repl.name, u_repl->name); diff --git a/ebtables.c b/ebtables.c index d5d24b0..62f1ba8 100644 --- a/ebtables.c +++ b/ebtables.c @@ -541,7 +541,7 @@ int do_command(int argc, char *argv[], int exec_style, char *buffer; int c, i; int zerochain = -1; /* Needed for the -Z option (we can have -Z -L ) */ - int chcounter; /* Needed for -C */ + int chcounter = 0; /* Needed for -C */ int policy = 0; int rule_nr = 0; int rule_nr_end = 0; diff --git a/extensions/ebt_among.c b/extensions/ebt_among.c index 2759b06..fe33e61 100644 --- a/extensions/ebt_among.c +++ b/extensions/ebt_among.c @@ -313,8 +313,8 @@ static int parse(int c, char **argv, int argc, struct ebt_mac_wormhash *wh; struct ebt_entry_match *h; int new_size; - long flen; - int fd; + long flen = 0L; + int fd = 0; switch (c) { case AMONG_DST_F: -- 1.7.3.4