summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSterling Hughes <sterling@php.net>2001-07-02 12:08:21 +0000
committerSterling Hughes <sterling@php.net>2001-07-02 12:08:21 +0000
commit4dc55c14a43d0b5325d48ed3d7f8bc51a8720f7f (patch)
treef487fd36e17b65ca99e5b96b54fa5421385e0d3a
parentd097b0ed8684af0acff69d6eeee082ecb7b0d4b2 (diff)
downloadphp-git-4dc55c14a43d0b5325d48ed3d7f8bc51a8720f7f.tar.gz
Fix possible corruption problem with curl_errno() and curl_error()
-rw-r--r--ext/curl/curl.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/ext/curl/curl.c b/ext/curl/curl.c
index 2ea1d1006f..13cffedf70 100644
--- a/ext/curl/curl.c
+++ b/ext/curl/curl.c
@@ -507,7 +507,8 @@ static void alloc_curl_handle(php_curl **ch)
(*ch)->handlers->write = ecalloc(1, sizeof(php_curl_write));
(*ch)->handlers->write_header = ecalloc(1, sizeof(php_curl_write));
(*ch)->handlers->read = ecalloc(1, sizeof(php_curl_read));
-
+ memset(&(*ch)->err, 0, sizeof((*ch)->err));
+
zend_llist_init(&(*ch)->to_free.str, sizeof(char *),
(void(*)(void *)) curl_free_string, 0);
zend_llist_init(&(*ch)->to_free.slist, sizeof(struct curl_slist),
@@ -943,6 +944,7 @@ PHP_FUNCTION(curl_error)
}
ZEND_FETCH_RESOURCE(ch, php_curl *, zid, -1, le_curl_name, le_curl);
+ ch->err.str[CURL_ERROR_SIZE] = 0;
RETURN_STRING(ch->err.str, 1);
}
/* }}} */