summaryrefslogtreecommitdiff
path: root/main/streams/userspace.c
diff options
context:
space:
mode:
authorChristian Stocker <chregu@php.net>2004-10-08 14:40:11 +0000
committerChristian Stocker <chregu@php.net>2004-10-08 14:40:11 +0000
commitbd99d77bf6b7ee31820e2251b09eaad8c4bd5b5d (patch)
treef7d9734a90d304af1df2745c1f1101fa3d22ee7f /main/streams/userspace.c
parent756ee85bec4e909ded0eb4da7b2a9d5803ce2266 (diff)
downloadphp-git-bd99d77bf6b7ee31820e2251b09eaad8c4bd5b5d.tar.gz
- Fixed bug #27183 (Userland stream wrapper segfaults on stream_write)
Was applied to PHP 4 ages ago, but not to PHP 5 branch
Diffstat (limited to 'main/streams/userspace.c')
-rw-r--r--main/streams/userspace.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/main/streams/userspace.c b/main/streams/userspace.c
index acc9845fa8..8cbd79d94e 100644
--- a/main/streams/userspace.c
+++ b/main/streams/userspace.c
@@ -501,15 +501,15 @@ static size_t php_userstreamop_write(php_stream *stream, const char *buf, size_t
int call_result;
php_userstream_data_t *us = (php_userstream_data_t *)stream->abstract;
zval **args[1];
- zval zbuff, *zbufptr;
+ zval *zbufptr;
size_t didwrite = 0;
assert(us != NULL);
ZVAL_STRINGL(&func_name, USERSTREAM_WRITE, sizeof(USERSTREAM_WRITE)-1, 0);
- ZVAL_STRINGL(&zbuff, (char*)buf, count, 0);
- zbufptr = &zbuff;
+ MAKE_STD_ZVAL(zbufptr);
+ ZVAL_STRINGL(zbufptr, (char*)buf, count, 1);;
args[0] = &zbufptr;
call_result = call_user_function_ex(NULL,
@@ -518,6 +518,7 @@ static size_t php_userstreamop_write(php_stream *stream, const char *buf, size_t
&retval,
1, args,
0, NULL TSRMLS_CC);
+ zval_ptr_dtor(&zbufptr);
didwrite = 0;
if (call_result == SUCCESS && retval != NULL) {