summaryrefslogtreecommitdiff
path: root/ext/soap/php_http.c
diff options
context:
space:
mode:
authorJan Kneschke <ostborn@php.net>2002-11-22 13:39:06 +0000
committerJan Kneschke <ostborn@php.net>2002-11-22 13:39:06 +0000
commit3598fbcef9bb96a4fbe3b77c1f0d5eace9475940 (patch)
tree4ebeba0cc128c8c7855f983765181eed39e50c8f /ext/soap/php_http.c
parent850586cfe7be3222469e70a188506dcbe9db5567 (diff)
downloadphp-git-3598fbcef9bb96a4fbe3b77c1f0d5eace9475940.tar.gz
- fixed a buffer under run
- initializing variables is a good thing - in case of a invalid response we don't seg-fault here anymore
Diffstat (limited to 'ext/soap/php_http.c')
-rw-r--r--ext/soap/php_http.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/ext/soap/php_http.c b/ext/soap/php_http.c
index 38243dbb93..80b5e4047d 100644
--- a/ext/soap/php_http.c
+++ b/ext/soap/php_http.c
@@ -214,8 +214,7 @@ void get_http_soap_response(zval *this_ptr, char **buffer, int *buffer_len)
efree(http_version);
}
-
-
+
if(!get_http_body(stream, http_headers, &http_body, &http_body_size))
php_error(E_ERROR, "Error Fetching http body");
@@ -368,15 +367,16 @@ int get_http_body(SOAP_STREAM stream, char *headers, char **response, int *out_
done = FALSE;
http_buf = emalloc(1);
+ *http_buf = '\0';
while(!done)
{
- cur = 0;
- while(!(chunk_size[cur - 2] == '\r' && chunk_size[cur - 1] == '\n'))
+ for (cur = 0; cur < 3 || !(chunk_size[cur - 2] == '\r' && chunk_size[cur - 1] == '\n'); cur++)
#ifdef PHP_STREAMS
- chunk_size[cur++] = php_stream_getc(stream);
+ chunk_size[cur] = php_stream_getc(stream);
#else
- chunk_size[cur++] = php_sock_fgetc(stream);
+ chunk_size[cur] = php_sock_fgetc(stream);
#endif
+ chunk_size[cur] = '\0';
if(sscanf(chunk_size,"%x",&buf_size) != -1)
{
http_buf = erealloc(http_buf,http_buf_size + buf_size);