From: Phil Sutter Date: Thu, 6 Aug 2015 12:24:32 +0000 (+0200) Subject: misc/ss: avoid NULL pointer dereference X-Git-Tag: v4.2.0~23 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e0dce0e5dc363b7e307984706c130f6ee769259b;p=thirdparty%2Fiproute2.git misc/ss: avoid NULL pointer dereference This was working before, but only if realloc a) succeeded and b) did not move the buffer to a different location. ''**buf = **new_buf' then writes the value of *new_buf's first field into that of *buf. Signed-off-by: Phil Sutter --- diff --git a/misc/ss.c b/misc/ss.c index f59213b4e..d271b9506 100644 --- a/misc/ss.c +++ b/misc/ss.c @@ -597,7 +597,7 @@ static int find_entry(unsigned ino, char **buf, int type) fprintf(stderr, "ss: failed to malloc buffer\n"); abort(); } - **buf = **new_buf; + *buf = *new_buf; buf_len = new_buf_len; continue; } else {