Skip to content
This repository was archived by the owner on Dec 20, 2024. It is now read-only.

Commit bd23388

Browse files
author
huaxiao
committed
fix the "index out of range" error when the length of speed is 0.
Signed-off-by: huaxiao <[email protected]>
1 parent 72b98ba commit bd23388

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

pkg/netutils/netutils.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ func NetLimit() *rate.Rate {
9898
continue
9999
}
100100
speed := compile.FindStringSubmatch(fields[1])
101+
if len(speed) == 0 {
102+
continue
103+
}
101104
if tmpLimit, err := strconv.ParseUint(speed[1], 0, 32); err == nil {
102105
tmpLimit = tmpLimit / 8
103106
if tmpLimit > maxInterfaceLimit {

0 commit comments

Comments
 (0)