From 023d1c96eae2fe97a50d6c2e210a315ca29a5f6f Mon Sep 17 00:00:00 2001 From: Greg Beaver Date: Mon, 14 Apr 2008 22:39:27 +0000 Subject: [PATCH] fix invalid variable access --- ext/phar/stream.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/ext/phar/stream.c b/ext/phar/stream.c index 03fe31b71a..a13159ac77 100644 --- a/ext/phar/stream.c +++ b/ext/phar/stream.c @@ -746,6 +746,13 @@ static int phar_wrapper_rename(php_stream_wrapper *wrapper, char *url_from, char return 0; } + + if (SUCCESS != phar_get_archive(&pfrom, resource_from->host, strlen(resource_from->host), NULL, 0, &error TSRMLS_CC)) { + pfrom = NULL; + if (error) { + efree(error); + } + } if (PHAR_G(readonly) && (!pfrom || !pfrom->is_data)) { php_url_free(resource_from); php_error_docref(NULL TSRMLS_CC, E_WARNING, "phar error: write operations disabled by phar.readonly INI setting"); @@ -764,10 +771,10 @@ static int phar_wrapper_rename(php_stream_wrapper *wrapper, char *url_from, char return 0; } - if (SUCCESS != phar_get_archive(&pfrom, resource_from->host, strlen(resource_from->host), NULL, 0, &error TSRMLS_CC)) { - pfrom = NULL; - } if (SUCCESS != phar_get_archive(&pto, resource_to->host, strlen(resource_to->host), NULL, 0, &error TSRMLS_CC)) { + if (error) { + efree(error); + } pto = NULL; } -- 2.40.0