Skip to content

Commit 268b698

Browse files
committed
Replace inet_ntoa with inet_ntop in ip2long
1 parent 93ab5e9 commit 268b698

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

ext/standard/basic_functions.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,8 @@ PHP_FUNCTION(ip2long)
605605
For consistency, we convert back the IP to a string and check if it is equal to
606606
the original string. If not, the IP should be considered invalid.
607607
*/
608-
if (strcmp(addr, inet_ntoa(ip)) != 0) {
608+
char str[INET_ADDRSTRLEN];
609+
if (strcmp(addr, inet_ntop(AF_INET, &ip, str, sizeof(str))) != 0) {
609610
RETURN_FALSE;
610611
}
611612
#endif

0 commit comments

Comments
 (0)