aboutsummaryrefslogtreecommitdiff
path: root/toys
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2021-06-08 10:35:48 -0700
committerRob Landley <rob@landley.net>2021-06-09 00:44:17 -0500
commit827cabf78905d4ccb24087df57f01adfeb30ad84 (patch)
tree18a881a754d2a55a932e3f3c5865e2daa36ce27a /toys
parent7ee66e9aec520afa1138876074b815295b6d1821 (diff)
downloadtoybox-827cabf78905d4ccb24087df57f01adfeb30ad84.tar.gz
netstat.c: fix bounds checks.
Diffstat (limited to 'toys')
-rw-r--r--toys/net/netstat.c4
1 files changed, 2 insertions, 2 deletions
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;