Skip to contentSkip to conversation

Fix for u32 match, problems when parsing arguments

PATCH Applied Piotr Gasidło 2 participants 2 messages Sep 2, 2004 netfilter

lore
Share & tools
lore
#0 lore raw

Hello,

I've found bug in u32 iptables helper library.

# iptables -A FORWARD -m u32 --u32 "0&0xffffffff=0"
iptables v1.2.11: u32: at char 2 error reading number

Attached patch, fixes problem.

Signature · 4 lines
Piotr 'QuakeR' Gasidło, BOFH @ pandora.barbara.eu.org
############## sending lusers to /dev/null since 1998
##### Waiting for tomorrow, for a little ray of light
### Waiting for tomorrow just to see your smile again
extensions/libipt_u32.c +1 -1
diff -uNr iptables.orig/extensions/libipt_u32.c iptables/extensions/libipt_u32.c
@@ -85,7 +85,7 @@
 	char *end;
 	errno = 0;
 
-	number = strtol(*s, &end, 0);
+	number = strtoul(*s, &end, 0);
 	if (end == *s)
 		exit_error(PARAMETER_PROBLEM, 
 			   "u32: at char %d expected number", pos);
#1 lore raw
Quoted 11 lines · Piotr Gasid³o

Hello,

I've found bug in u32 iptables helper library.

# iptables -A FORWARD -m u32 --u32 "0&0xffffffff=0"
iptables v1.2.11: u32: at char 2 error reading number

Attached patch, fixes problem.

Applied, thanks.

Regards
Patrick

Quoted 18 lines

------------------------------------------------------------------------

diff -uNr iptables.orig/extensions/libipt_u32.c iptables/extensions/libipt_u32.c

extensions/libipt_u32.c +1 -1
@@ -85,7 +85,7 @@
 	char *end;
 	errno = 0;
 
-	number = strtol(*s, &end, 0);
+	number = strtoul(*s, &end, 0);
 	if (end == *s)
 		exit_error(PARAMETER_PROBLEM, 
 			   "u32: at char %d expected number", pos);