mirror of
https://github.com/u-boot/u-boot.git
synced 2024-11-27 22:56:49 +08:00
lib: net_utils: enforce '.' as octet separator in string_to_ip
Ensure '.' is used to separate octets. If another character is seen reject the string outright and return 0.0.0.0. Signed-off-by: Chris Packham <judge.packham@gmail.com>
This commit is contained in:
parent
d921ed9a2a
commit
f267e40f96
@ -28,6 +28,10 @@ struct in_addr string_to_ip(const char *s)
|
||||
addr.s_addr = 0;
|
||||
return addr;
|
||||
}
|
||||
if (i != 3 && *e != '.') {
|
||||
addr.s_addr = 0;
|
||||
return addr;
|
||||
}
|
||||
addr.s_addr <<= 8;
|
||||
addr.s_addr |= (val & 0xFF);
|
||||
if (s) {
|
||||
|
Loading…
Reference in New Issue
Block a user