]> git.proxmox.com Git - mirror_iproute2.git/commit
ss: fix NULL pointer access when parsing unix sockets with oldformat
authorAntonio Quartulli <a@unstable.cc>
Sat, 6 Jan 2018 18:31:50 +0000 (02:31 +0800)
committerStephen Hemminger <stephen@networkplumber.org>
Tue, 9 Jan 2018 16:02:46 +0000 (08:02 -0800)
commitebbb219c924ccedbc59e209d40b77d5dbeecd7cd
tree7a212b08e342d28f273cc580a4a7a027f89f720d
parent192be8fccbdd752f37afc31ee0fa806a662bb9dd
ss: fix NULL pointer access when parsing unix sockets with oldformat

When parsing and printing the unix sockets in unix_show(),
if the oldformat is detected, the peer_name member of the sockstat
object is left uninitialized (NULL).
For this reason, if a filter has been specified on the command line,
a strcmp() will crash when trying to access it.

Avoid crash by checking that peer_name is not NULL before
passing it to strcmp().

Cc: Stefano Brivio <sbrivio@redhat.com>
Cc: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Antonio Quartulli <a@unstable.cc>
Reviewed-by: Stefano Brivio <sbrivio@redhat.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
misc/ss.c