diff options
Diffstat (limited to 'main/streams/xp_socket.c')
| -rw-r--r-- | main/streams/xp_socket.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/main/streams/xp_socket.c b/main/streams/xp_socket.c index 5b7e32917..60084545d 100644 --- a/main/streams/xp_socket.c +++ b/main/streams/xp_socket.c @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: xp_socket.c,v 1.33.2.2 2006/02/02 18:16:43 pollita Exp $ */ +/* $Id: xp_socket.c,v 1.33.2.2.2.1 2006/10/11 12:53:56 tony2001 Exp $ */ #include "php.h" #include "ext/standard/file.h" @@ -495,7 +495,7 @@ static inline char *parse_ip_address_ex(const char *str, int str_len, int *portn #ifdef HAVE_IPV6 char *p; - if (*(str) == '[') { + if (*(str) == '[' && str_len > 1) { /* IPV6 notation to specify raw address with port (i.e. [fe80::1]:80) */ p = memchr(str + 1, ']', str_len - 2); if (!p || *(p + 1) != ':') { @@ -508,8 +508,11 @@ static inline char *parse_ip_address_ex(const char *str, int str_len, int *portn return estrndup(str + 1, p - str - 1); } #endif - - colon = memchr(str, ':', str_len - 1); + if (str_len) { + colon = memchr(str, ':', str_len - 1); + } else { + colon = NULL; + } if (colon) { *portno = atoi(colon + 1); host = estrndup(str, colon - str); |
