Skip to content

Commit 5c3cb35

Browse files
committed
Merge branch 'PHP-8.0'
* PHP-8.0: fix bug #72998
2 parents 5de50e2 + 1143155 commit 5c3cb35

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,9 @@ PHP NEWS
121121
. Convert resource<pspell> to object \PSpell\Dictionary. (Sara)
122122
. Convert resource<pspell config> to object \PSpell\Config. (Sara)
123123

124+
- readline:
125+
. Fixed bug #72998 (invalid read in readline completion). (krakjoe)
126+
124127
- Reflection:
125128
. Implement ReflectionFunctionAbstract::getClosureUsedVariables (krakjoe)
126129

ext/readline/readline.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -452,12 +452,12 @@ char **php_readline_completion_cb(const char *text, int start, int end)
452452
if (zend_hash_num_elements(Z_ARRVAL(_readline_array))) {
453453
matches = rl_completion_matches(text,_readline_command_generator);
454454
} else {
455-
matches = malloc(sizeof(char *) * 2);
455+
/* libedit will read matches[2] */
456+
matches = calloc(sizeof(char *), 3);
456457
if (!matches) {
457458
return NULL;
458459
}
459460
matches[0] = strdup("");
460-
matches[1] = NULL;
461461
}
462462
}
463463
}

0 commit comments

Comments
 (0)