diff options
author | Elliott Hughes <enh@google.com> | 2021-06-08 10:35:48 -0700 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2021-06-09 00:44:17 -0500 |
commit | 827cabf78905d4ccb24087df57f01adfeb30ad84 (patch) | |
tree | 18a881a754d2a55a932e3f3c5865e2daa36ce27a /toys | |
parent | 7ee66e9aec520afa1138876074b815295b6d1821 (diff) | |
download | toybox-827cabf78905d4ccb24087df57f01adfeb30ad84.tar.gz |
netstat.c: fix bounds checks.
Diffstat (limited to 'toys')
-rw-r--r-- | toys/net/netstat.c | 4 |
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; |