dmitry          Thu May 27 03:58:23 2004 EDT

  Modified files:              
    /php-src/ext/soap   php_http.c soap.c 
  Log:
  BUGFIX: Prevent crash on error in send_http_soap_request()
  
  
http://cvs.php.net/diff.php/php-src/ext/soap/php_http.c?r1=1.51&r2=1.52&ty=u
Index: php-src/ext/soap/php_http.c
diff -u php-src/ext/soap/php_http.c:1.51 php-src/ext/soap/php_http.c:1.52
--- php-src/ext/soap/php_http.c:1.51    Thu May 20 12:55:02 2004
+++ php-src/ext/soap/php_http.c Thu May 27 03:58:22 2004
@@ -17,7 +17,7 @@
   |          Dmitry Stogov <[EMAIL PROTECTED]>                             |
   +----------------------------------------------------------------------+
 */
-/* $Id: php_http.c,v 1.51 2004/05/20 16:55:02 dmitry Exp $ */
+/* $Id: php_http.c,v 1.52 2004/05/27 07:58:22 dmitry Exp $ */
 
 #include "php_soap.h"
 #include "ext/standard/base64.h"
@@ -217,7 +217,6 @@
          if (phpurl != NULL) {
                php_url_free(phpurl);
          }
-               xmlFree(buf);
                add_soap_fault(this_ptr, "HTTP", "Unable to parse URL", NULL, NULL 
TSRMLS_CC);
                return FALSE;
        }
@@ -226,14 +225,12 @@
        if (phpurl->scheme != NULL && strcmp(phpurl->scheme, "https") == 0) {
                use_ssl = 1;
        } else if (phpurl->scheme == NULL || strcmp(phpurl->scheme, "http") != 0) {
-               xmlFree(buf);
                php_url_free(phpurl);
                add_soap_fault(this_ptr, "HTTP", "Unknown protocol. Only http and 
https are allowed.", NULL, NULL TSRMLS_CC);
                return FALSE;
        }
 #ifdef ZEND_ENGINE_2
        if (use_ssl && php_stream_locate_url_wrapper("https://";, NULL, 
STREAM_LOCATE_WRAPPERS_ONLY TSRMLS_CC) == NULL) {
-               xmlFree(buf);
                php_url_free(phpurl);
                add_soap_fault(this_ptr, "HTTP", "SSL support not available in this 
build", NULL, NULL TSRMLS_CC);
                return FALSE;
@@ -241,7 +238,6 @@
 #else
 #ifndef HAVE_OPENSSL_EXT
        if (use_ssl) {
-               xmlFree(buf);
                php_url_free(phpurl);
                add_soap_fault(this_ptr, "HTTP", "SSL support not available in this 
build", NULL, NULL TSRMLS_CC);
                return FALSE;
@@ -291,7 +287,6 @@
                        add_property_resource(this_ptr, "httpsocket", 
php_stream_get_resource_id(stream));
                        add_property_long(this_ptr, "_use_proxy", use_proxy);
                } else {
-                       xmlFree(buf);
                        php_url_free(phpurl);
                        add_soap_fault(this_ptr, "HTTP", "Could not connect to host", 
NULL, NULL TSRMLS_CC);
                        return FALSE;
@@ -382,7 +377,6 @@
                                        request_size = Z_STRLEN(retval);
                                } else {
                                        if (request != buf) {efree(request);}
-                                       xmlFree(buf);
                                        smart_str_free(&soap_headers);
                                        php_stream_close(stream);
                                        zend_hash_del(Z_OBJPROP_P(this_ptr), 
"httpurl", sizeof("httpurl"));
@@ -471,7 +465,6 @@
                err = php_stream_write(stream, soap_headers.c, soap_headers.len);
                if (err != soap_headers.len) {
                        if (request != buf) {efree(request);}
-                       xmlFree(buf);
                        smart_str_free(&soap_headers);
                        php_stream_close(stream);
                        zend_hash_del(Z_OBJPROP_P(this_ptr), "httpurl", 
sizeof("httpurl"));
http://cvs.php.net/diff.php/php-src/ext/soap/soap.c?r1=1.104&r2=1.105&ty=u
Index: php-src/ext/soap/soap.c
diff -u php-src/ext/soap/soap.c:1.104 php-src/ext/soap/soap.c:1.105
--- php-src/ext/soap/soap.c:1.104       Thu May 20 12:55:02 2004
+++ php-src/ext/soap/soap.c     Thu May 27 03:58:22 2004
@@ -17,7 +17,7 @@
   |          Dmitry Stogov <[EMAIL PROTECTED]>                             |
   +----------------------------------------------------------------------+
 */
-/* $Id: soap.c,v 1.104 2004/05/20 16:55:02 dmitry Exp $ */
+/* $Id: soap.c,v 1.105 2004/05/27 07:58:22 dmitry Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -1924,6 +1924,7 @@
   zval   func;
        zval  *params[4];
        zval **trace;
+       zval **fault;
 
        INIT_ZVAL(*response);
 
@@ -1959,6 +1960,9 @@
                add_property_stringl(this_ptr, "__last_response", 
Z_STRVAL_P(response), Z_STRLEN_P(response), 1);
        }
        xmlFree(buf);
+       if (ret && zend_hash_find(Z_OBJPROP_P(this_ptr), "__soap_fault", 
sizeof("__soap_fault"), (void **) &fault) == SUCCESS) {
+         return FALSE;
+       }         
   return ret;
 }
 

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to