Fix copying too much leading to potential segfault

This commit is contained in:
Bob Weinand 2017-01-25 13:00:48 +01:00
parent 80a851b4dd
commit c44efbbbb1

View File

@ -616,7 +616,7 @@ int phpdbg_compile(void) /* {{{ */
memmove(data->line + 1, data->line, sizeof(uint) * data->lines);
data->line[0] = 0;
data->buf = erealloc(data->buf, data->len + start_line_len);
memmove(data->buf + start_line_len, data->buf, data->len * sizeof(uint));
memmove(data->buf + start_line_len, data->buf, data->len);
memcpy(data->buf, start_line, start_line_len);
efree(start_line);
data->len += start_line_len;