diff options
| author | Felipe Pena <felipe@php.net> | 2011-11-11 21:39:11 +0000 |
|---|---|---|
| committer | Felipe Pena <felipe@php.net> | 2011-11-11 21:39:11 +0000 |
| commit | 72a133f155f1f397e2e58c0c178f752e29899b49 (patch) | |
| tree | caeabdc69b17e9ea7aab8c32f5c012ed00d4d4af | |
| parent | 0c00f3a15c90efc43f26decd3ab12ba876cae00f (diff) | |
| download | php-git-72a133f155f1f397e2e58c0c178f752e29899b49.tar.gz | |
- Fixed bug #60261 (phar dos null pointer)
| -rw-r--r-- | NEWS | 3 | ||||
| -rw-r--r-- | ext/phar/tests/bug60261.phpt | 19 | ||||
| -rwxr-xr-x | ext/spl/spl_directory.c | 5 |
3 files changed, 26 insertions, 1 deletions
@@ -16,6 +16,9 @@ PHP NEWS - Oracle Database extension (OCI8): . Fixed bug #59985 (show normal warning text for OCI_NO_DATA) (Chris Jones) + +- Phar: + . Fixed bug #60261 (phar dos null pointer). (Felipe) 03 Nov 2011, PHP 5.3.9RC1 diff --git a/ext/phar/tests/bug60261.phpt b/ext/phar/tests/bug60261.phpt new file mode 100644 index 0000000000..1b6cd7a7cd --- /dev/null +++ b/ext/phar/tests/bug60261.phpt @@ -0,0 +1,19 @@ +--TEST-- +Bug #60261 (phar dos null pointer) +--SKIPIF-- +<?php if (!extension_loaded("phar")) die("skip"); ?> +--FILE-- +<?php + +$nx = new Phar(); +try { + $nx->getLinkTarget(); +} catch (Exception $e) { + echo $e->getMessage(), "\n"; +} + +?> +--EXPECTF-- + +Warning: Phar::__construct() expects at least 1 parameter, 0 given in %s on line %d +SplFileInfo::getLinkTarget(): Empty filename diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c index bba1922c07..d898adf678 100755 --- a/ext/spl/spl_directory.c +++ b/ext/spl/spl_directory.c @@ -1215,7 +1215,10 @@ SPL_METHOD(SplFileInfo, getLinkTarget) zend_replace_error_handling(EH_THROW, spl_ce_RuntimeException, &error_handling TSRMLS_CC); #if defined(PHP_WIN32) || HAVE_SYMLINK - if (!IS_ABSOLUTE_PATH(intern->file_name, intern->file_name_len)) { + if (intern->file_name == NULL) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty filename"); + RETURN_FALSE; + } else if (!IS_ABSOLUTE_PATH(intern->file_name, intern->file_name_len)) { char expanded_path[MAXPATHLEN]; /* TODO: Fix expand_filepath to do not resolve links but only expand the path |
