Skip to content

Commit b2c00ec

Browse files
szsamnashif
authored andcommitted
net: utils: fix offset used before range check
This use of offset 'i' should follow the range check. Signed-off-by: Mingjie Shen <[email protected]>
1 parent 733a358 commit b2c00ec

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

subsys/net/ip/utils.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -894,7 +894,7 @@ bool net_ipaddr_parse(const char *str, size_t str_len, struct sockaddr *addr)
894894
return parse_ipv6(str, str_len, addr, true);
895895
}
896896

897-
for (count = i = 0; str[i] && i < str_len; i++) {
897+
for (count = i = 0; i < str_len && str[i]; i++) {
898898
if (str[i] == ':') {
899899
count++;
900900
}

0 commit comments

Comments
 (0)