setsockopt SO_BINDTODEVICE bug

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Take a look at net/core/sock.c line 217:

    if(optlen<sizeof(int))
        return(-EINVAL);

For SO_BINDTODEVICE, optlen is length of device name plus one byte. For 
"lo\0" this is three bytes which is less than sizeof(int).

The idea of checking optlen this way is fundamentally incompatible with 
the idea of string length. We are comparing apples vs. oranges here.

Is this check necessary at all? For example, in NetBSD, they check 
uap->valsize to ensure it is smaller than mbuf.

Attachment: pgpKlpWtdHrvq.pgp
Description: PGP signature


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux