Skip to contentSkip to conversation

Bug or dead code in net/unix/af_unix.c:unix_mkname()

DISCUSSION James Antill 1 participant 1 message Oct 11, 2004

lore
Share & tools
lore
#0 lore raw

unix_mkname() looks like (in both 2.4.x and 2.6.x)...

static int unix_mkname(struct sockaddr_un * sunaddr, int len, unsigned *hashp)

{
        if (len <= sizeof(short) || len > sizeof(*sunaddr))
                return -EINVAL;

[...]
if (len > sizeof(*sunaddr))
len = sizeof(*sunaddr);

...so if you pass a "large" sockaddr_un struct bind() just returns -EINVAL. I assume that is intentional, but that just makes the huge comment and test later dead code.

Signature · 1 line
James Antill