Skip to content

Commit e4fb2ab

Browse files
committed
Address review comments
1 parent ca58557 commit e4fb2ab

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

ext/standard/basic_functions.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -600,13 +600,15 @@ PHP_FUNCTION(ip2long)
600600
}
601601
#ifdef _AIX
602602
/*
603-
AIX accepts IP strings with excedentary 0 (192.168.042.42 will be treated as
604-
192.168.42.42), while Linux don't.
603+
AIX accepts IP strings with extraneous 0 (192.168.042.42 will be treated as
604+
192.168.42.42), while Linux doesn't.
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
*/
608608
char str[INET_ADDRSTRLEN];
609-
if (strcmp(addr, inet_ntop(AF_INET, &ip, str, sizeof(str))) != 0) {
609+
const char* result = inet_ntop(AF_INET, &ip, str, sizeof(str));
610+
ZEND_ASSERT(result != NULL);
611+
if (strcmp(addr, result) != 0) {
610612
RETURN_FALSE;
611613
}
612614
#endif

0 commit comments

Comments
 (0)