From 0b8b85706437d0bb3466697cb22da13eacd51e70 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Sun, 14 Apr 2024 09:11:12 -0700 Subject: [PATCH] u8-line: Fix read past end of buffer in u8_line_find_pos(). --- src/libpspp/u8-line.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libpspp/u8-line.c b/src/libpspp/u8-line.c index 1374314a11..bc58c506f6 100644 --- a/src/libpspp/u8-line.c +++ b/src/libpspp/u8-line.c @@ -108,7 +108,7 @@ u8_line_find_pos (const struct u8_line *line, int target_x, struct u8_pos *c) x = 0; c->x0 = 0; c->ofs0 = 0; - for (ofs = 0; ofs <= length; ofs += mblen) + for (ofs = 0; ofs < length; ofs += mblen) { int w; c->x0 = x; -- 2.30.2