]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
fix segfault from memory allocation: handle->entries is actualy struct ipt_get_entrie...
authorHarald Welte <laforge@gnumonks.org>
Sun, 19 Sep 2004 21:00:12 +0000 (21:00 +0000)
committerHarald Welte <laforge@gnumonks.org>
Sun, 19 Sep 2004 21:00:12 +0000 (21:00 +0000)
libiptc/libiptc.c

index f6a0233ae70e1d1d4af07ad010f7e9784c38ef96..f017e498c288b89cd3f0bd49084e620b73b7ec1c 100644 (file)
@@ -1,4 +1,4 @@
-/* Library which manipulates firewall rules.  Version $Revision: 1.48 $ */
+/* Library which manipulates firewall rules.  Version $Revision: 1.49 $ */
 
 /* Architecture of firewall rules is as follows:
  *
@@ -750,11 +750,12 @@ alloc_handle(const char *tablename, unsigned int size, unsigned int num_rules)
        INIT_LIST_HEAD(&h->chains);
        strcpy(h->info.name, tablename);
 
-       h->entries = malloc(size);
+       h->entries = malloc(sizeof(STRUCT_GET_ENTRIES) + size);
        if (!h->entries)
                goto out_free_handle;
 
        strcpy(h->entries->name, tablename);
+       h->entries->size = size;
 
        return h;