cvs: php-src(PHP_5_0) /main network.c
| From: | Wez Furlong | Date: | Wed, 28 Jul 2004 23:53:05 +0000 |
| Subject: | cvs: php-src(PHP_5_0) /main network.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-28047@lists.php.net to get a copy of this message | ||
wez Wed Jul 28 19:53:05 2004 EDT
Modified files: (Branch: PHP_5_0)
/php-src/main network.c
Log:
MFH: #29431
http://cvs.php.net/diff.php/php-src/main/network.c?r1=1.109&r2=1.109.2.1&ty=u
Index: php-src/main/network.c
diff -u php-src/main/network.c:1.109 php-src/main/network.c:1.109.2.1
--- php-src/main/network.c:1.109 Fri Apr 9 15:18:59 2004
+++ php-src/main/network.c Wed Jul 28 19:53:04 2004
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: network.c,v 1.109 2004/04/09 19:18:59 pollita Exp $ */
+/* $Id: network.c,v 1.109.2.1 2004/07/28 23:53:04 wez Exp $ */
/*#define DEBUG_MAIN_NETWORK 1*/
@@ -495,12 +495,15 @@
if (*addr == '[') {
colon = memchr(addr + 1, ']', addrlen-1);
if (!colon || colon[1] != ':') {
- return 0;
+ return FAILURE;
}
port = atoi(colon + 2);
addr++;
} else {
colon = memchr(addr, ':', addrlen);
+ if (!colon) {
+ return FAILURE;
+ }
port = atoi(colon + 1);
}
@@ -589,8 +592,8 @@
/* generally not thread safe, but it *is* thread safe under win32 */
buf = inet_ntoa(((struct sockaddr_in*)sa)->sin_addr);
if (buf) {
- *textaddrlen = strlen(buf);
- *textaddr = estrndup(buf, *textaddrlen);
+ *textaddrlen = spprintf(textaddr, 0, "%s:%d",
+ buf, ntohs(((struct sockaddr_in*)sa)->sin_port));
}
break;
@@ -599,8 +602,8 @@
case AF_INET6:
buf = (char*)inet_ntop(sa->sa_family, &((struct sockaddr_in6*)sa)->sin6_addr, (char
*)&abuf, sizeof(abuf));
if (buf) {
- *textaddrlen = strlen(buf);
- *textaddr = estrndup(buf, *textaddrlen);
+ *textaddrlen = spprintf(textaddr, 0, "%s:%d",
+ buf, ntohs(((struct sockaddr_in6*)sa)->sin6_port));
}
break;