Skip to content

Commit 42b22d3

Browse files
committed
Fix out of bounds write in phpdbg
It seems that this code has a peculiar interpretation of "len", where it actually points to the last character, not one past it. So we need +1 here for that extra char and another +1 for the terminating null byte.
1 parent 8757f30 commit 42b22d3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

sapi/phpdbg/phpdbg_prompt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,7 @@ PHPDBG_COMMAND(run) /* {{{ */
838838
while (*p == ' ') p++;
839839
while (*p) {
840840
char sep = ' ';
841-
char *buf = emalloc(end - p + 1), *q = buf;
841+
char *buf = emalloc(end - p + 2), *q = buf;
842842

843843
if (*p == '<') {
844844
/* use as STDIN */

0 commit comments

Comments
 (0)