From: Ben Pfaff Date: Sun, 14 Apr 2024 16:11:12 +0000 (-0700) Subject: u8-line: Fix read past end of buffer in u8_line_find_pos(). X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0b8b85706437d0bb3466697cb22da13eacd51e70;p=pspp u8-line: Fix read past end of buffer in u8_line_find_pos(). --- 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;