fix segfault from memory allocation: handle->entries is actualy struct ipt_get_entries plus the size
diff --git a/libiptc/libiptc.c b/libiptc/libiptc.c
index f6a0233..f017e49 100644
--- a/libiptc/libiptc.c
+++ b/libiptc/libiptc.c
@@ -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 @@
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;