projects
/
project
/
bcm63xx
/
u-boot.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d921ed9
)
lib: net_utils: enforce '.' as octet separator in string_to_ip
author
Chris Packham
<judge.packham@gmail.com>
Wed, 4 Jan 2017 00:36:26 +0000
(13:36 +1300)
committer
Tom Rini
<trini@konsulko.com>
Sat, 14 Jan 2017 21:47:11 +0000
(16:47 -0500)
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>
lib/net_utils.c
patch
|
blob
|
history
diff --git
a/lib/net_utils.c
b/lib/net_utils.c
index 8f81e78010333bb96987febcb874dc74ac7e32c8..d06be22849fb44643e484029c50d2181d6f46344 100644
(file)
--- a/
lib/net_utils.c
+++ b/
lib/net_utils.c
@@
-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) {