Skip to content
Snippets Groups Projects
Commit f267e40f authored by Chris Packham's avatar Chris Packham Committed by Tom Rini
Browse files

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: default avatarChris Packham <judge.packham@gmail.com>
parent d921ed9a
No related branches found
No related tags found
No related merge requests found
......@@ -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) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment