]> granicus.if.org Git - php/commitdiff
- Fixed bug #27183 (Userland stream wrapper segfaults on stream_write)
authorChristian Stocker <chregu@php.net>
Fri, 8 Oct 2004 14:40:11 +0000 (14:40 +0000)
committerChristian Stocker <chregu@php.net>
Fri, 8 Oct 2004 14:40:11 +0000 (14:40 +0000)
Was applied to PHP 4 ages ago, but not to PHP 5 branch

NEWS
main/streams/userspace.c

diff --git a/NEWS b/NEWS
index 644b5ceecb5e7b86b288c782f72b32b6fb609105..21cee836e05fed6c700f76efd36942e763bf0a0d 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -54,6 +54,7 @@ PHP                                                                        NEWS
 - Fixed bug #29061 (soap extension segfaults). (Dmitry)
 - Fixed bug #28985 (__getTypes() returning nothing on complex WSDL). (Dmitry)
 - Fixed bug #28969 (Wrong data encoding of special characters). (Dmitry)
+- Fixed bug #27183 (Userland stream wrapper segfaults on stream_write). (Christian)
 
 13 Jul 2004, PHP 5.0.0
 - Rewritten UNIX and Windows install help files. (Documentation Team)
index acc9845fa8d1cd32ab933b6d19e612d4f998e0bd..8cbd79d94e4725a4d64e69bb76d4dba7d160e4de 100644 (file)
@@ -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) {