Guy Decoux wrote: > A Sussex wrote: >> I'm attempting to read the address assigned to an interface. After >> calling ioctl(SIOCGIFADDR) - which is 0x8915 on my system - I find >> that the destination buffer is corrupted and contains random garbage. > > Well, on linux it can't know the size of the argument given to > ioctl(2) and for this reason it give it to ioctl() an argument with > a default length of (256 + 1). This is why you see that buf has a > size of 257 after the call to #ioctl. > > You must use only the valid part of buf after the call. So I guess I'm seeing bits of irb's memory because the extended part of buf isn't initialised before use. (Please correct me if I'm wrong.) Thanks for your help.