3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-22 21:22:37 +01:00

monitor: Fix buffer overrun

When printing New Address events, the extra_str buffer is overrun,
resulting in weird stuff happening.

> RTNL: Error (0x02) len 20				> 5.252075
   Flags: 0 (0x000)
   Sequence number: 189 (0x000000bd)
   Port ID: 2116
    ACK: 0
==4080== Invalid read of size 1
==4080==    at 0x4E8000E: vfprintf (in /lib64/libc-2.20.so)
==4080==    by 0x4EA8A24: vsnprintf (in /lib64/libc-2.20.so)
==4080==    by 0x4E86011: snprintf (in /lib64/libc-2.20.so)
==4080==    by 0x403B64: print_packet (nlmon.c:238)
==4080==    by 0x40C8FD: print_nlmsghdr (nlmon.c:3197)
==4080==    by 0x40CD9E: print_rtnl_msg (nlmon.c:3266)
==4080==    by 0x40CE4F: nlmon_print_rtnl (nlmon.c:3298)
==4080==    by 0x40D1CD: nlmon_receive (nlmon.c:3390)
This commit is contained in:
Denis Kenzior 2015-04-12 12:25:55 -05:00
parent bc98bc9ecb
commit 90c922f2ca

View File

@ -3179,7 +3179,7 @@ static const char *nlmsg_type_to_str(uint32_t msg_type)
static void print_nlmsghdr(const struct timeval *tv, static void print_nlmsghdr(const struct timeval *tv,
const struct nlmsghdr *nlmsg) const struct nlmsghdr *nlmsg)
{ {
char extra_str[32]; char extra_str[256];
const char *str; const char *str;
bool out; bool out;