All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] segmentation fault in free
@ 2004-08-26 13:36 Thomas Woerner
  2004-08-26 16:14 ` Patrick McHardy
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Woerner @ 2004-08-26 13:36 UTC (permalink / raw)
  To: netfilter-devel

[-- Attachment #1: Type: text/plain, Size: 636 bytes --]


Hello,


I have found a bad bug in iptables. saddrs and daddrs are allocated with calloc in 
host_to_addr if a hostname resolves to more than one ip address, but each array 
element if getting freed in do_command. The first free will free the whole array and 
the others are returning that this is not a pointer or are segfaulting.

Fix for this is attached.


Thanks,
Thomas

-- 
Thomas Woerner
Software Engineer            Phone: +49-711-96437-310
Red Hat GmbH                 Fax  : +49-711-96437-111
Hauptstaetterstr. 58         Email: Thomas Woerner <twoerner@redhat.com>
D-70178 Stuttgart            Web  : http://www.redhat.de/

[-- Attachment #2: iptables-1.2.11-free.patch --]
[-- Type: text/x-patch, Size: 369 bytes --]

--- iptables-1.2.11/iptables.c.free	2004-08-25 19:15:29.000000000 +0200
+++ iptables-1.2.11/iptables.c	2004-08-26 15:34:28.490605182 +0200
@@ -2344,11 +2344,8 @@
 		e = NULL;
 	}
 
-	for (c = 0; c < nsaddrs; c++)
-		free(&saddrs[c]);
-
-	for (c = 0; c < ndaddrs; c++)
-		free(&daddrs[c]);
+	free(saddrs);
+	free(daddrs);
 
 	if (opts != original_opts) {
 		free(opts);

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] segmentation fault in free
  2004-08-26 13:36 [PATCH] segmentation fault in free Thomas Woerner
@ 2004-08-26 16:14 ` Patrick McHardy
  0 siblings, 0 replies; 2+ messages in thread
From: Patrick McHardy @ 2004-08-26 16:14 UTC (permalink / raw)
  To: Thomas Woerner; +Cc: netfilter-devel

Thomas Woerner wrote:

>
> Hello,
>
>
> I have found a bad bug in iptables. saddrs and daddrs are allocated 
> with calloc in host_to_addr if a hostname resolves to more than one ip 
> address, but each array element if getting freed in do_command. The 
> first free will free the whole array and the others are returning that 
> this is not a pointer or are segfaulting.
>
> Fix for this is attached.


Thanks, already fixed in CVS.

Regards
Patrick

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-08-26 16:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-08-26 13:36 [PATCH] segmentation fault in free Thomas Woerner
2004-08-26 16:14 ` Patrick McHardy

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.