mirror of
https://github.com/apache/nuttx.git
synced 2026-05-29 20:56:47 +08:00
inet_addr: return INADDR_NONE(-1) when input string is invalid
now:
inet_network("300.10.10.10"); return 0
inet_addr("300.10.10.10"); return 0
glibc and muscle both return INADDR_NONE or -1.
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
This commit is contained in:
@@ -88,7 +88,7 @@ in_addr_t inet_addr(FAR const char *cp)
|
|||||||
unsigned int b;
|
unsigned int b;
|
||||||
unsigned int c;
|
unsigned int c;
|
||||||
unsigned int d;
|
unsigned int d;
|
||||||
uint32_t result = 0;
|
uint32_t result = INADDR_NONE;
|
||||||
|
|
||||||
switch (sscanf(cp, "%u.%u.%u.%u", &a, &b, &c, &d))
|
switch (sscanf(cp, "%u.%u.%u.%u", &a, &b, &c, &d))
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user