Re: [MERGE] Initial netfilter mark patch for comment

From: Andrew Beverley <andy_at_andybev.com>
Date: Tue, 17 Aug 2010 13:17:09 +0100

> Seems the netfilter guys found a major problem with strtoul().
> Thankfully the same fix should work for us as well.
>
>
> Luciano Coelho wrote:
> <snip>
> >
> > Not easily. I found that there is a bug in strtoul (and strtoull for
> > that matter) that causes the long to overflow if there are valid digits
> > after the maximum possible digits for the base. For example if you try
> > to strtoul 0xfffffffff (with 9 f's) the strtoul will overflow and come
> > up with a bogus result. I can't easily truncate the string to avoid
> > this problem, because with decimal or octal, the same valid value would
> > take more spaces. I could do some magic here, checking whether it's a
> > hex, dec or oct and truncate appropriately, but that would be very ugly.
> >
> > So the simplest way I came up with was to use strtoull and return
> > -EINVAL if the value exceeds 32 bits. ;)
> >

Thanks for that Amos. I have to admit that when I was doing my initial
browse of the iptables mark module, I noticed that they had their own
xtables_strtoui function which limited the size. I'll check this out a
bit more thoroughly.

I'm away at the moment with minimal internet access, but I hope to pick
up again on the patch shortly.

Cheers,

Andy
Received on Tue Aug 17 2010 - 12:29:06 MDT

This archive was generated by hypermail 2.2.0 : Tue Aug 17 2010 - 12:00:04 MDT