bug: bad use of signed/unsigned in gifconf functions

Michael Elizabeth Chastain (mec@shout.net)
Fri, 16 Jan 1998 11:18:54 -0600


I was looking at SIOCGIFCONF in 2.1.79 and noticed some bad use of
signed and unsigned arithmetic.

In file net/core/dev.c, function dev_ifconf, 'len' is declared as
'unsigned int' but is used as a signed integer and can take on
negative values if ifc.ifc_buf == NULL or ifc.ifc_len == 0.

In file net/ipv4/devinet.c, function inet_gifconf, 'len' is a signed
integer. But it is compared to an unsigned quantity: sizeof(ifr).
This comparison will be done in an unsigned way, so negative values
of len will not compare as expected.

Finally, for the sake of future modularity, an unregister_gifconf
function will be needed.

Michael Chastain
<mailto:mec@shout.net>
"love without fear"