[iptables] libiptc: guard chain index allocation for different malloc implementations
Patrick McHardy
netfilter-cvslog-bounces at lists.netfilter.org
Wed Nov 26 17:22:49 CET 2008
Gitweb: http://git.netfilter.org/cgi-bin/gitweb.cgi?p=iptables.git;a=commit;h=0eee3009e7015b82a46b2eccad91f759d75ec4df
commit 0eee3009e7015b82a46b2eccad91f759d75ec4df
Author: Jan Engelhardt <jengelh at medozas.de>
AuthorDate: Wed Nov 26 17:18:08 2008 +0100
Commit: Patrick McHardy <kaber at trash.net>
CommitDate: Wed Nov 26 17:18:08 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 at medozas.de>
Signeed-off-by: Patrick McHardy <kaber at trash.net>
via 0eee3009e7015b82a46b2eccad91f759d75ec4df (commit)
from 64f948b24407c3cf3d02476059a3f9fa0265cb3d (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 0eee3009e7015b82a46b2eccad91f759d75ec4df
Author: Jan Engelhardt <jengelh at medozas.de>
Date: Wed Nov 26 17:18:08 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 at medozas.de>
Signeed-off-by: Patrick McHardy <kaber at trash.net>
-----------------------------------------------------------------------
libiptc/libiptc.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
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 at medozas.de>
Signeed-off-by: Patrick McHardy <kaber at trash.net>
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;
}
More information about the netfilter-cvslog
mailing list