On Sat, 28 Jul 2012, Arnaud Lacombe wrote:
Hi,
On Sat, Jul 28, 2012 at 6:14 PM, Bjoern A. Zeeb
<bzeeb-li...@lists.zabbadoz.net> wrote:
On Wed, 25 Jul 2012, Luigi Rizzo wrote:
During some ipfw/dummynet cleanup i noticed that the libkern version of
inet_ntoa_r() is missing the buffer size argument that is present in
the libc counterpart.
Any objection if i fix it ?
And why exactly would you need it? What does libc do with it? Render
partial IPv4 addresses?
Mitigate possibilities of memory corruption ? At the very least, allow
the following:
{
char tmp[sizeof "255.255.255.255"];
char tmp[INET_ADDRSTRLEN];
KASSERT(size >= (sizeof tmp));
This would need to go into the called library function and cannot.
[...]
So that gives you what extra checking exactly? That the programmer got
the sizeof right rather than the buffer size? You pushed some more on the
stack or reused an register for something that is supposed to be at a
minial fixed length (nothing else lower allowed and will ever result
in anything but misbehaviour) no matter what. It's not like it's
inet_pton which can take totally different sizes.
Which again leaves me with the question - why does libc have it?
/bz
--
Bjoern A. Zeeb You have to have visions!
Stop bit received. Insert coin for new address family.
_______________________________________________
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"