]> granicus.if.org Git - php/commitdiff
Fixed bug #21529 (memory corruption by fsockopen()).
authorIlia Alshanetsky <iliaa@php.net>
Thu, 9 Jan 2003 03:33:15 +0000 (03:33 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Thu, 9 Jan 2003 03:33:15 +0000 (03:33 +0000)
ext/standard/fsock.c

index dd08714a37186f7ad74c435af5ba08fa53257e68..d1f37a46dc0fd3163a50a5f8389b453c4b21acdf 100644 (file)
@@ -178,7 +178,7 @@ static void php_fsockopen_stream(INTERNAL_FUNCTION_PARAMETERS, int persistent)
        }
        if (zerrstr) {
                zval_dtor(zerrstr);
-               ZVAL_STRING(zerrno, "", 1);
+               ZVAL_STRING(zerrstr, "", 1);
        }
 
        if (port > 0)   { /* connect to a host */
@@ -261,6 +261,7 @@ static void php_fsockopen_stream(INTERNAL_FUNCTION_PARAMETERS, int persistent)
                        char *buf = php_socket_strerror(err, NULL, 0);
 
                        /* no need to dup; we would only need to efree buf anyway */
+                       zval_dtor(zerrstr);
                        ZVAL_STRING(zerrstr, buf, 0);
                }
                RETURN_FALSE;