mirror of
https://github.com/status-im/miniupnp.git
synced 2025-02-18 00:46:30 +00:00
miniupnpc: Fix checking for inet_pton() errors
inet_pton() indicates error by zero or negative return value.
This commit is contained in:
parent
9ef311d235
commit
0d5b416e05
@ -62,7 +62,7 @@ int addr_is_reserved(const char * addr_str)
|
|||||||
return 1;
|
return 1;
|
||||||
#else
|
#else
|
||||||
/* was : addr_n = inet_addr(addr_str); */
|
/* was : addr_n = inet_addr(addr_str); */
|
||||||
if (inet_pton(AF_INET, addr_str, &addr_n) < 0) {
|
if (inet_pton(AF_INET, addr_str, &addr_n) <= 0) {
|
||||||
/* error */
|
/* error */
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -716,7 +716,7 @@ ssdpDiscoverDevices(const char * const deviceTypes[],
|
|||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
/* was : mc_if.s_addr = inet_addr(multicastif); */ /* ex: 192.168.x.x */
|
/* was : mc_if.s_addr = inet_addr(multicastif); */ /* ex: 192.168.x.x */
|
||||||
if (inet_pton(AF_INET, multicastif, &mc_if.s_addr) < 0) {
|
if (inet_pton(AF_INET, multicastif, &mc_if.s_addr) <= 0) {
|
||||||
mc_if.s_addr = INADDR_NONE;
|
mc_if.s_addr = INADDR_NONE;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user