dmitry Tue Jun 22 08:42:17 2004 EDT
Modified files:
/php-src/ext/soap php_http.c
Log:
BUGFIX: Segfault if server's URL has no path. ("http://192.168.8.1:180")
http://cvs.php.net/diff.php/php-src/ext/soap/php_http.c?r1=1.54&r2=1.55&ty=u
Index: php-src/ext/soap/php_http.c
diff -u php-src/ext/soap/php_http.c:1.54 php-src/ext/soap/php_http.c:1.55
--- php-src/ext/soap/php_http.c:1.54 Mon Jun 21 08:56:33 2004
+++ php-src/ext/soap/php_http.c Tue Jun 22 08:42:17 2004
@@ -17,7 +17,7 @@
| Dmitry Stogov <[EMAIL PROTECTED]> |
+----------------------------------------------------------------------+
*/
-/* $Id: php_http.c,v 1.54 2004/06/21 12:56:33 dmitry Exp $ */
+/* $Id: php_http.c,v 1.55 2004/06/22 12:42:17 dmitry Exp $ */
#include "php_soap.h"
#include "ext/standard/base64.h"
@@ -372,7 +372,9 @@
smart_str_appendc(&soap_headers, ':');
smart_str_append_unsigned(&soap_headers, phpurl->port);
}
- smart_str_appends(&soap_headers, phpurl->path);
+ if (phpurl->path) {
+ smart_str_appends(&soap_headers, phpurl->path);
+ }
if (phpurl->query) {
smart_str_appendc(&soap_headers, '?');
smart_str_appends(&soap_headers, phpurl->query);
@@ -452,7 +454,7 @@
Z_TYPE_PP(value) == IS_STRING) {
zval **tmp;
if
(zend_hash_index_find(Z_ARRVAL_PP(data), 1, (void**)&tmp) == SUCCESS &&
-
strncmp(phpurl->path,Z_STRVAL_PP(tmp),Z_STRLEN_PP(tmp)) == 0 &&
+
strncmp(phpurl->path?phpurl->path:"/",Z_STRVAL_PP(tmp),Z_STRLEN_PP(tmp)) == 0 &&
zend_hash_index_find(Z_ARRVAL_PP(data), 2, (void**)&tmp) == SUCCESS &&
in_domain(phpurl->host,Z_STRVAL_PP(tmp)) &&
(use_ssl ||
zend_hash_index_find(Z_ARRVAL_PP(data), 3, (void**)&tmp) == FAILURE)) {
@@ -543,12 +545,13 @@
new_url->scheme = estrdup(phpurl->scheme);
new_url->host = estrdup(phpurl->host);
new_url->port = phpurl->port;
- if (new_url->path[0] != '/') {
- char *p = strrchr(phpurl->path, '/');
- char *s = emalloc((p - phpurl->path)
+ strlen(new_url->path) + 2);
+ if (new_url->path && new_url->path[0]
!= '/') {
+ char *t =
phpurl->path?phpurl->path:"/";
+ char *p = strrchr(t, '/');
+ char *s = emalloc((p - t) +
strlen(new_url->path) + 2);
- strncpy(s, phpurl->path, (p -
phpurl->path) + 1);
- s[(p - phpurl->path) + 1] = 0;
+ strncpy(s, t, (p - t) + 1);
+ s[(p - t) + 1] = 0;
strcat(s, new_url->path);
efree(new_url->path);
new_url->path = s;
@@ -661,9 +664,10 @@
}
}
if (!zend_hash_index_exists(Z_ARRVAL_P(zcookie), 1)) {
- char *c = strrchr(phpurl->path, '/');
+ char *t = phpurl->path?phpurl->path:"/";
+ char *c = strrchr(t, '/');
if (c) {
- add_index_stringl(zcookie, 1, phpurl->path,
c-phpurl->path, 1);
+ add_index_stringl(zcookie, 1, t, c-t, 1);
}
}
if (!zend_hash_index_exists(Z_ARRVAL_P(zcookie), 2)) {
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php