com php-src: Fixed bug #69054 (Null dereference in readline_ (read|write)_history() without parameters): NEWS ext/readline/readline.c
ext/readline/tests/bug6 9054.phpt

From: Date: Sun, 15 Feb 2015 14:54:05 +0000
Subject: com php-src: Fixed bug #69054 (Null dereference in readline_ (read|write)_history() without parameters): NEWS ext/readline/readline.c
ext/readline/tests/bug6 9054.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-84923@lists.php.net to get a copy of this message
Commit: a620b7904023202b8b4a5d7792368bd752c432e9 Author: Xinchen Hui <laruence@php.net> Sun, 15 Feb 2015 22:54:05 +0800 Parents: 7667f8efc6ee9727cbd7af26e5f62f9cebd8a25e Branches: PHP-5.5 PHP-5.6 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=a620b7904023202b8b4a5d7792368bd752c432e9 Log: Fixed bug #69054 (Null dereference in readline_(read|write)_history() without parameters) Bugs: https://bugs.php.net/69054 Changed paths: M NEWS M ext/readline/readline.c A ext/readline/tests/bug69054.phpt Diff: diff --git a/NEWS b/NEWS index a0ffd3e..3cb8960 100644 --- a/NEWS +++ b/NEWS @@ -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 f48194a..8cf7734 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 0000000..f17f803 --- /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==

« previous php.cvs (#84923) next »