cvs: pear /PECL/soap php_http.c
| From: | Jan Kneschke | Date: | Fri, 22 Nov 2002 13:39:06 +0000 |
| Subject: | cvs: pear /PECL/soap php_http.c | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-7519@lists.php.net to get a copy of this message | ||
ostborn Fri Nov 22 08:39:06 2002 EDT
Modified files:
/pear/PECL/soap php_http.c
Log:
- fixed a buffer under run
- initializing variables is a good thing
- in case of a invalid response we don't seg-fault here anymore
Index: pear/PECL/soap/php_http.c
diff -u pear/PECL/soap/php_http.c:1.5 pear/PECL/soap/php_http.c:1.6
--- pear/PECL/soap/php_http.c:1.5 Sun Sep 15 16:45:46 2002
+++ pear/PECL/soap/php_http.c Fri Nov 22 08:39:06 2002
@@ -214,8 +214,7 @@
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 @@
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);