Re: iptables (1.4.2 release) failed to run on embedded system with "can't initialize iptables table `filter'"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tuesday 2008-11-25 20:07, David Wu wrote:
> On Tue, 25 Nov 2008 12:45:55 -0500, Jan Engelhardt <jengelh@xxxxxxxxxx> wrote:
>> On Tuesday 2008-11-25 18:10, David Wu wrote:
>> >
>> >It seems that I really have a 0 chains to start. Does this include default
>> >chains or is it only user defined chains?
>>
>> Apparently only user-defined chains. Seems ok to me.
>
> Then will there be a patch for the implementation of malloc() which returns a
> NULL for 0 size allocation?

Like this?
(Patrick, try not to screw up utf-8 in the git log too often ;-)

commit 3430170eca6bf73b590ddbd1a1ee0573862ff555
Author: Jan Engelhardt <jengelh@xxxxxxxxxx>
Date:   Wed Nov 26 17:13:57 2008 +0100

libiptc: guard chain index allocation for different malloc implementations

Some libc implementations such as µClibc return NULL on malloc(0).
They are free to do that per C standard.

Signed-off-by: Jan Engelhardt <jengelh@xxxxxxxxxx>
---
 libiptc/libiptc.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/libiptc/libiptc.c b/libiptc/libiptc.c
index 13e4c69..544a5b2 100644
--- a/libiptc/libiptc.c
+++ b/libiptc/libiptc.c
@@ -503,7 +503,7 @@ static int iptcc_chain_index_alloc(struct xtc_handle *h)
 	      array_elems, array_mem);
 
 	h->chain_index = malloc(array_mem);
-	if (!h->chain_index) {
+	if (h->chain_index == NULL && array_mem > 0) {
 		h->chain_index_sz = 0;
 		return -ENOMEM;
 	}

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux