nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit 7d3a555464e1b6b4b55ea7929b95cb47f04c0efb
parent 0508520b477a9612c9273491dd74418d299c8519
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Sun, 24 Jan 2021 17:03:22 +0100

tweaks: avoid the vague possibility of advancing beyond end-of-line

Like the other two fragments that advance over a zero-length match,
also this fragment should avoid the possibility of stepping beyond
the end of the line.

Diffstat:
Msrc/winio.c | 2++
1 file changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/winio.c b/src/winio.c @@ -2524,6 +2524,8 @@ void draw_row(int row, const char *converted, linestruct *line, size_t from_col) /* If the match has length zero, advance over it. */ if (match.rm_so == match.rm_eo) { + if (line->data[index] == '\0') + break; index = step_right(line->data, index); continue; }