Skip to content

Commit 45a1dc5

Browse files
committed
Fix possible method call on None object (CWE-476)
If we don't have current device parsed yet, doesn't make sense to parse next lines of ifconfig output.
1 parent 7a5f234 commit 45a1dc5

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

tests/parse_ifconfig.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,11 @@ def __init__(self, stdout=None, debug=False):
113113
curdev._parse_rest_of_first_line_old(mo.group(2))
114114
continue
115115

116+
# If we don't have current device yet, doesn't make sense to
117+
# read the rest of output lines
118+
if curdev is None:
119+
continue
120+
116121
if self.oldFormat:
117122
curdev._parse_line_old(line)
118123
else:

0 commit comments

Comments
 (0)