Fixes: 341573406b39 Don't subtract one from the result of strnlen() when trying to point to the first character after the current string. This issue would cause individual characters (where the 128 byte buffers are stitched together) to be lost.
gcc/ChangeLog: * config/aarch64/driver-aarch64.cc (readline): Fix off-by-one. Signed-off-by: Philipp Tomsich <philipp.toms...@vrull.eu> --- gcc/config/aarch64/driver-aarch64.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gcc/config/aarch64/driver-aarch64.cc b/gcc/config/aarch64/driver-aarch64.cc index 52ff537908e..48250e68034 100644 --- a/gcc/config/aarch64/driver-aarch64.cc +++ b/gcc/config/aarch64/driver-aarch64.cc @@ -203,9 +203,9 @@ readline (FILE *f) return std::string (); /* If we're not at the end of the line then override the \0 added by fgets. */ - last = strnlen (buf, size) - 1; + last = strnlen (buf, size); } - while (!feof (f) && buf[last] != '\n'); + while (!feof (f) && (last > 0 && buf[last - 1] != '\n')); std::string result (buf); free (buf); -- 2.34.1