diff options
| author | Mark A. Hershberger <mah@debian.(none)> | 2009-03-25 00:36:21 -0400 |
|---|---|---|
| committer | Mark A. Hershberger <mah@debian.(none)> | 2009-03-25 00:36:21 -0400 |
| commit | d29a4fd2dd3b5d4cf6e80b602544d7b71d794e76 (patch) | |
| tree | b38e2e5c6974b9a15f103e5cf884cba9fff90ef4 /main/streams/xp_socket.c | |
| parent | a88a88d0986a4a32288c102cdbfebd78d7e91d99 (diff) | |
| download | php-upstream/5.2.0.tar.gz | |
Imported Upstream version 5.2.0upstream/5.2.0
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); |
