diff --git a/NEWS b/NEWS index a4fb945bdc..69bcadf991 100644 --- a/NEWS +++ b/NEWS @@ -121,6 +121,9 @@ PHP NEWS . Convert resource to object \PSpell\Dictionary. (Sara) . Convert resource to object \PSpell\Config. (Sara) +- readline: + . Fixed bug #72998 (invalid read in readline completion). (krakjoe) + - Reflection: . Implement ReflectionFunctionAbstract::getClosureUsedVariables (krakjoe) diff --git a/ext/readline/readline.c b/ext/readline/readline.c index 14fcea0ab0..7331b43798 100644 --- a/ext/readline/readline.c +++ b/ext/readline/readline.c @@ -452,12 +452,12 @@ char **php_readline_completion_cb(const char *text, int start, int end) if (zend_hash_num_elements(Z_ARRVAL(_readline_array))) { matches = rl_completion_matches(text,_readline_command_generator); } else { - matches = malloc(sizeof(char *) * 2); + /* libedit will read matches[2] */ + matches = calloc(sizeof(char *), 3); if (!matches) { return NULL; } matches[0] = strdup(""); - matches[1] = NULL; } } }