Skip to content

Commit 631eb29

Browse files
committed
🐛 fix panic in iptables
Signed-off-by: Ivan Milchev <ivan@mondoo.com>
1 parent c5ba74a commit 631eb29

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

providers/os/resources/iptables.go

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -274,17 +274,20 @@ func ParseStat(lines []string, ipv6 bool) ([]Stat, error) {
274274
opts = strings.Join(o, " ")
275275
}
276276
entry := Stat{
277-
LineNumber: ln,
278-
Packets: pkts,
279-
Bytes: bts,
280-
Target: fields[3],
281-
Protocol: fields[4],
282-
Opt: fields[5],
283-
Input: fields[6],
284-
Output: fields[7],
285-
Source: fields[8],
286-
Destination: fields[9],
287-
Options: opts,
277+
LineNumber: ln,
278+
Packets: pkts,
279+
Bytes: bts,
280+
Target: fields[3],
281+
Protocol: fields[4],
282+
Opt: fields[5],
283+
Input: fields[6],
284+
Output: fields[7],
285+
Source: fields[8],
286+
Options: opts,
287+
}
288+
289+
if len(fields) > 9 {
290+
entry.Destination = fields[9]
288291
}
289292
entries = append(entries, entry)
290293
}

0 commit comments

Comments
 (0)