tech-net archive

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

Re: getnameinfo extra len checking

> I'm happy we don't have SIN_LEN() which subtracts the number of zero
> bytes at the end of the IP address ;)

Heh.  IMO those zero bytes are a horrible botch which should never have
been there and should not be checked by anything against anything.

> Aaaanyway, the whole issue is a little unfortunate given that SUSv3
> doesn't require sa_len.

I think this is a case where we should say "the standard is broken,
screw it, we're going to do it right".  As Thor pointed out, you have
to either carry around a length field yourself with every sockaddr, you
have to do ugly layer-violating AF-aware hacks, or you have to use
sa_len.  Like him, I agree that sa_len is the right way.  (Though I
really think it should be wider than u_char; as it stands, there is no
way to set sa_len correctly if the address is longer than 255 bytes,
which AF_LOCAL may well be.  Unfortunately that runs smack into ABI
combatability issues.)

/~\ The ASCII                             Mouse
\ / Ribbon Campaign
 X  Against HTML      
/ \ Email!           7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B

Home | Main Index | Thread Index | Old Index