Commit e0dce0e5 authored by Phil Sutter's avatar Phil Sutter Committed by Stephen Hemminger

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: default avatarPhil Sutter <phil@nwl.cc>
parent fdba0515
...@@ -597,7 +597,7 @@ static int find_entry(unsigned ino, char **buf, int type) ...@@ -597,7 +597,7 @@ static int find_entry(unsigned ino, char **buf, int type)
fprintf(stderr, "ss: failed to malloc buffer\n"); fprintf(stderr, "ss: failed to malloc buffer\n");
abort(); abort();
} }
**buf = **new_buf; *buf = *new_buf;
buf_len = new_buf_len; buf_len = new_buf_len;
continue; continue;
} else { } else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment