From: Martin Josefsson Date: Wed, 22 Sep 2004 22:04:07 +0000 (+0000) Subject: Make sure to zero all the memory we allocate for the new table. X-Git-Tag: v1.3.0-rc1~51 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ad3b4f9973ac15981b98b8fc4d364ef1ce524212;p=thirdparty%2Fiptables.git Make sure to zero all the memory we allocate for the new table. Makes flushing of chains containing more than a few entries work without potentially oopsing the kernel. --- diff --git a/libiptc/libiptc.c b/libiptc/libiptc.c index 7c711b19..957af672 100644 --- a/libiptc/libiptc.c +++ b/libiptc/libiptc.c @@ -1,4 +1,4 @@ -/* Library which manipulates firewall rules. Version $Revision: 1.54 $ */ +/* Library which manipulates firewall rules. Version $Revision: 1.55 $ */ /* Architecture of firewall rules is as follows: * @@ -1962,7 +1962,7 @@ TC_COMMIT(TC_HANDLE_T *handle) errno = ENOMEM; return 0; } - memset(repl, 0, sizeof(*repl)); + memset(repl, 0, sizeof(*repl) + new_size); counterlen = sizeof(STRUCT_COUNTERS_INFO) + sizeof(STRUCT_COUNTERS) * new_number;