summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2017-08-24 11:41:27 +0200
committerStephen Hemminger <stephen@networkplumber.org>2017-08-24 15:22:10 -0700
commit0aa03350c00d70edbbdab0662a2d8262be2bb68d (patch)
tree0b177dce534b112ce2f5fb5f1564f1a14ad8271e
parent4cbf5224f2b50a24e1873508e7a0f1f81cc81a81 (diff)
ss: Make sure scanned index value to unix_state_map is sane
Signed-off-by: Phil Sutter <phil@nwl.cc>
-rw-r--r--misc/ss.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/misc/ss.c b/misc/ss.c
index be498ebe..fcc3cf92 100644
--- a/misc/ss.c
+++ b/misc/ss.c
@@ -3148,7 +3148,8 @@ static int unix_show(struct filter *f)
if (flags & (1 << 16)) {
u->state = SS_LISTEN;
- } else {
+ } else if (u->state > 0 &&
+ u->state <= ARRAY_SIZE(unix_state_map)) {
u->state = unix_state_map[u->state-1];
if (u->type == SOCK_DGRAM && u->state == SS_CLOSE && u->rport)
u->state = SS_ESTABLISHED;