naccyde / rpms / iproute

Forked from rpms/iproute 7 months ago
Clone

Blame SOURCES/0112-ss-Make-sure-scanned-index-value-to-unix_state_map-i.patch

36cfb7
From f92edf9b3d088bf8a5619073de43b2f693590be8 Mon Sep 17 00:00:00 2001
36cfb7
From: Andrea Claudi <aclaudi@redhat.com>
36cfb7
Date: Mon, 29 Apr 2019 20:08:08 +0200
36cfb7
Subject: [PATCH] ss: Make sure scanned index value to unix_state_map is sane
36cfb7
36cfb7
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1465646
36cfb7
Upstream Status: iproute2.git commit 0aa03350c00d7
36cfb7
36cfb7
commit 0aa03350c00d70edbbdab0662a2d8262be2bb68d
36cfb7
Author: Phil Sutter <phil@nwl.cc>
36cfb7
Date:   Thu Aug 24 11:41:27 2017 +0200
36cfb7
36cfb7
    ss: Make sure scanned index value to unix_state_map is sane
36cfb7
36cfb7
    Signed-off-by: Phil Sutter <phil@nwl.cc>
36cfb7
---
36cfb7
 misc/ss.c | 3 ++-
36cfb7
 1 file changed, 2 insertions(+), 1 deletion(-)
36cfb7
36cfb7
diff --git a/misc/ss.c b/misc/ss.c
36cfb7
index 2a981d8b06918..fdb00a9f3f696 100644
36cfb7
--- a/misc/ss.c
36cfb7
+++ b/misc/ss.c
36cfb7
@@ -3236,7 +3236,8 @@ static int unix_show(struct filter *f)
36cfb7
 
36cfb7
 		if (flags & (1 << 16)) {
36cfb7
 			u->state = SS_LISTEN;
36cfb7
-		} else {
36cfb7
+		} else if (u->state > 0 &&
36cfb7
+			   u->state <= ARRAY_SIZE(unix_state_map)) {
36cfb7
 			u->state = unix_state_map[u->state-1];
36cfb7
 			if (u->type == SOCK_DGRAM && u->state == SS_CLOSE && u->rport)
36cfb7
 				u->state = SS_ESTABLISHED;
36cfb7
-- 
e138d9
2.21.0
36cfb7