ss: Fix socket type check in packet_show_line()
Subsystems (2)
PATCH 1/1 ss: Fix socket type check in packet_show_line()
The field is accessed before being assigned a meaningful value, effectively disabling the checks.
Fixes 4a0053b606a34 ("ss: Unify packet stats output from netlink and proc")
Signed-off-by Phil Sutter <[email protected]>
--- misc/ss.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
misc/ss.c +2 -2
@@ -4534,9 +4534,9 @@ static int packet_show_line(char *buf, const struct filter *f, int fam) &type, &prot, &iface, &state, &rq, &uid, &ino); -if (stat.type ==SOCK_RAW && !(f->dbs&(1 <<PACKET_R_DB ))) +if (type ==SOCK_RAW && !(f->dbs&(1 <<PACKET_R_DB )))return 0 ; -if (stat.type ==SOCK_DGRAM && !(f->dbs&(1 <<PACKET_DG_DB ))) +if (type ==SOCK_DGRAM && !(f->dbs&(1 <<PACKET_DG_DB )))return 0 ; stat.type = type;
Signature · 1 line
2.41.0