diff options
| author | Uwe Steinmann <steinm@php.net> | 2002-07-03 06:10:29 +0000 | 
|---|---|---|
| committer | Uwe Steinmann <steinm@php.net> | 2002-07-03 06:10:29 +0000 | 
| commit | 47b5b8da58c3f8a8d24f97dd54f8233cb3173f79 (patch) | |
| tree | bc7f5e82f1f6e1329e7ab7e55ee3dd2e629fa4df | |
| parent | 980d7a11a978791ba89429610dcec3e646c6919c (diff) | |
| download | php-git-47b5b8da58c3f8a8d24f97dd54f8233cb3173f79.tar.gz | |
- fixed bug in hwnew_new_document_from_file
| -rw-r--r-- | ext/hyperwave/hw.c | 17 | 
1 files changed, 7 insertions, 10 deletions
| diff --git a/ext/hyperwave/hw.c b/ext/hyperwave/hw.c index 89a70e9be3..5fce6aca67 100644 --- a/ext/hyperwave/hw.c +++ b/ext/hyperwave/hw.c @@ -2863,14 +2863,8 @@ PHP_FUNCTION(hw_new_document)  PHP_FUNCTION(hw_new_document_from_file)  {  	pval **arg1, **arg2; -	int len, type;  	char *ptr; -	int issock=0; -	int socketd=0; -	FILE *fp;  	php_stream *stream; -	int ready=0; -	int bcount=0;  	int use_include_path=0;  	hw_document *doc; @@ -2895,13 +2889,16 @@ PHP_FUNCTION(hw_new_document_from_file)  	doc->size = php_stream_copy_to_mem(stream, &doc->data, PHP_STREAM_COPY_ALL, 1);  	php_stream_close(stream); -	 -	doc->data = realloc(doc->data, bcount+1); + +	/* I'm not sure if it is necessary to add a '\0'. It depends on whether +	 * PHP-Strings has to be null terminated. doc->size doesn't count the +	 * '\0'. +	 */ +	doc->data = realloc(doc->data, doc->size+1);  	ptr = doc->data; -	ptr[bcount] = '\0'; +	ptr[doc->size] = '\0';  	doc->attributes = strdup(Z_STRVAL_PP(arg1));  	doc->bodytag = NULL; -	doc->size = bcount;  	Z_LVAL_P(return_value) = zend_list_insert(doc, le_document);  	Z_TYPE_P(return_value) = IS_LONG;  } | 
