diff options
author | Xinchen Hui <laruence@php.net> | 2015-02-15 22:54:05 +0800 |
---|---|---|
committer | Xinchen Hui <laruence@php.net> | 2015-02-15 22:54:05 +0800 |
commit | a620b7904023202b8b4a5d7792368bd752c432e9 (patch) | |
tree | 92f7c8e722f4122aeb128a1c810c5a894dbda072 | |
parent | 7667f8efc6ee9727cbd7af26e5f62f9cebd8a25e (diff) | |
download | php-git-a620b7904023202b8b4a5d7792368bd752c432e9.tar.gz |
Fixed bug #69054 (Null dereference in readline_(read|write)_history() without parameters)
-rw-r--r-- | NEWS | 4 | ||||
-rw-r--r-- | ext/readline/readline.c | 5 | ||||
-rw-r--r-- | ext/readline/tests/bug69054.phpt | 11 |
3 files changed, 18 insertions, 2 deletions
@@ -18,6 +18,10 @@ PHP NEWS . Fixed bug #68638 (pg_update() fails to store infinite values). (william dot welter at 4linux dot com dot br, Laruence) +- Readline: + . Fixed bug #69054 (Null dereference in readline_(read|write)_history() without + parameters). (Laruence) + - CGI: . Fixed bug #69015 (php-cgi's getopt does not see $argv). (Laruence) diff --git a/ext/readline/readline.c b/ext/readline/readline.c index f48194a439..8cf7734b62 100644 --- a/ext/readline/readline.c +++ b/ext/readline/readline.c @@ -400,12 +400,13 @@ PHP_FUNCTION(readline_read_history) return; } - if (php_check_open_basedir(arg TSRMLS_CC)) { + if (arg && php_check_open_basedir(arg TSRMLS_CC)) { RETURN_FALSE; } /* XXX from & to NYI */ if (read_history(arg)) { + /* If filename is NULL, then read from `~/.history' */ RETURN_FALSE; } else { RETURN_TRUE; @@ -424,7 +425,7 @@ PHP_FUNCTION(readline_write_history) return; } - if (php_check_open_basedir(arg TSRMLS_CC)) { + if (arg && php_check_open_basedir(arg TSRMLS_CC)) { RETURN_FALSE; } diff --git a/ext/readline/tests/bug69054.phpt b/ext/readline/tests/bug69054.phpt new file mode 100644 index 0000000000..f17f803ea4 --- /dev/null +++ b/ext/readline/tests/bug69054.phpt @@ -0,0 +1,11 @@ +--TEST-- +Bug #69054 (Null dereference in readline_(read|write)_history() without parameters) +--SKIPIF-- +<?php if (!extension_loaded("readline") || !function_exists('readline_add_history')) die("skip"); ?> +--INI-- +open_basedir=/tmp +--FILE-- +<?php readline_read_history(); ?> +==DONE== +--EXPECT-- +==DONE== |