From 827cabf78905d4ccb24087df57f01adfeb30ad84 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Tue, 8 Jun 2021 10:35:48 -0700 Subject: netstat.c: fix bounds checks. --- toys/net/netstat.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'toys') diff --git a/toys/net/netstat.c b/toys/net/netstat.c index 24a2ceed..7eed02da 100644 --- a/toys/net/netstat.c +++ b/toys/net/netstat.c @@ -182,8 +182,8 @@ static void show_unix_sockets(void) if (state==1 && flags && !(FLAG(a) || FLAG(l))) continue; if (type==10) type = 7; // move SOCK_PACKET into line - if (type>ARRAY_LEN(types)) type = 0; - if (state>ARRAY_LEN(states) || (state==1 && !flags)) state = 0; + if (type>=ARRAY_LEN(types)) type = 0; + if (state>=ARRAY_LEN(states) || (state==1 && !flags)) state = 0; if (state!=1 && FLAG(l)) continue; -- cgit v1.2.3