Red Hat Bugzilla – Bug 11468
ifconfig parsing bug
Last modified: 2008-05-01 11:37:55 EDT
ifconfig doesnt parse its arguments properly and generate a syntax error
in the case that more than one address is specified. For example:
ifconfig eth0 192.168.1.1 192.168.2.2 192.168.3.3 192.168.4.4 192.168.5.5
will generate five calls to ioctl(SIOCSIFADDR). One for each with the
final address being set. Now imagine if someone types
ifconfig eth0 192.168.1.1 mask 255.255.240.0
ifconfig eth0 192.168.1.1 netmask 255.255.240.0
and further suppose that that user is unlucky enough to have a machine
called "mask" on their network. Then the final address set of
255.255.240.0 will fail (it is an invalid address) and the machine will be
left with its IP address being the same as that of machine "mask".
This is bad. ifconfig should check its arguments properly and fail with
a usage message if too many are specified.