diff options
author | Ondřej Bílka <neleai@seznam.cz> | 2014-06-05 19:21:32 +0200 |
---|---|---|
committer | Ondřej Bílka <neleai@seznam.cz> | 2014-06-05 19:25:23 +0200 |
commit | d89b3d80f92035acda41010b8d68b32bc471b846 (patch) | |
tree | c89c96980db91624a932dbc01d410930600f2361 /sysdeps/unix | |
parent | bd1b9d956b9ce90a5fa265bde97d984129cffae9 (diff) | |
download | glibc-d89b3d80f92035acda41010b8d68b32bc471b846.tar.gz glibc-d89b3d80f92035acda41010b8d68b32bc471b846.tar.xz glibc-d89b3d80f92035acda41010b8d68b32bc471b846.zip |
Fix memory overrun in getifaddrs_internal. Fixes bug 15698.
Diffstat (limited to 'sysdeps/unix')
-rw-r--r-- | sysdeps/unix/sysv/linux/ifaddrs.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sysdeps/unix/sysv/linux/ifaddrs.c b/sysdeps/unix/sysv/linux/ifaddrs.c index d83e8f8e84..6deb09445b 100644 --- a/sysdeps/unix/sysv/linux/ifaddrs.c +++ b/sysdeps/unix/sysv/linux/ifaddrs.c @@ -780,10 +780,10 @@ getifaddrs_internal (struct ifaddrs **ifap) else preflen = ifam->ifa_prefixlen; - for (i = 0; i < (preflen / 8); i++) + for (i = 0; i < ((preflen - 1) / 8); i++) *cp++ = 0xff; c = 0xff; - c <<= (8 - (preflen % 8)); + c <<= ((128 - preflen) % 8); *cp = c; } } |