diff options
author | laforge <laforge> | 2004-09-19 21:00:12 +0000 |
---|---|---|
committer | laforge <laforge> | 2004-09-19 21:00:12 +0000 |
commit | 31622c7dc75c79faad42f6501f6a38fe8c9cd34e (patch) | |
tree | dabacfdfdf91cf1c32d6301a68ba464e07dece9d /libiptc | |
parent | d056294bf539938033246a768f818d14ddf34f50 (diff) |
fix segfault from memory allocation: handle->entries is actualy struct ipt_get_entries plus the size
Diffstat (limited to 'libiptc')
-rw-r--r-- | libiptc/libiptc.c | 5 |
1 files changed, 3 insertions, 2 deletions
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 @@ 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; |