From: Karsten Desler <kdesler@soohrt.org>
To: netfilter-devel@lists.netfilter.org
Subject: minor bug in iptables 1.2.9
Date: Fri, 30 Jan 2004 09:48:32 +0100 [thread overview]
Message-ID: <20040130084832.GA5527@sit0.ifup.net> (raw)
[-- Attachment #1: Type: text/plain, Size: 534 bytes --]
Hi,
while reading the iptables 1.2.9 source, I found this small bug in
iptables.c line 276:
struct in_addr *
dotted_to_addr(const char *dotted)
{
char buf[20];
...
/* copy dotted string, because we need to modify it */
strncpy(buf, dotted, sizeof(buf) - 1);
...
strncpy does not \0-terminate strings if strlen(src) == n, thus the
following loop can easily run over the end of buf, if a big enough
mask is given:
iptables -A INPUT -p tcp -s 1.1.1.1/000000000000000000.
Attached is a patch to fix this problem.
Karsten
[-- Attachment #2: iptables-1.2.9-overflow.patch --]
[-- Type: text/plain, Size: 311 bytes --]
--- iptables~.c 2004-01-30 09:34:29.000000000 +0100
+++ iptables.c 2004-01-30 09:35:14.000000000 +0100
@@ -274,6 +274,7 @@
/* copy dotted string, because we need to modify it */
strncpy(buf, dotted, sizeof(buf) - 1);
+ buf[sizeof(buf) - 1] = '\0';
addrp = (unsigned char *) &(addr.s_addr);
p = buf;
next reply other threads:[~2004-01-30 8:48 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-01-30 8:48 Karsten Desler [this message]
2004-01-31 13:23 ` minor bug in iptables 1.2.9 Martin Josefsson
2004-01-31 13:56 ` Karsten Desler
2004-01-31 15:20 ` Martin Josefsson
[not found] ` <20040131142932.GB11570@soohrt.org>
2004-01-31 15:35 ` Martin Josefsson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20040130084832.GA5527@sit0.ifup.net \
--to=kdesler@soohrt.org \
--cc=netfilter-devel@lists.netfilter.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.