From 082a7b239096caf422f7ef138e2729b2730c0d70 Mon Sep 17 00:00:00 2001 From: Nathan Sidwell Date: Tue, 3 Nov 2020 08:32:42 -0800 Subject: [PATCH] cpplib: Fix off-by-one error I noticed a fencepost error in the preprocessor. We should be checking if the next char is at the limit, not the current char (which can't be, because we're looking at it). libcpp/ * lex.c (_cpp_clean_line): Fix DOS off-by-one error. --- libcpp/lex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libcpp/lex.c b/libcpp/lex.c index fb222924c8c..1d522030a3c 100644 --- a/libcpp/lex.c +++ b/libcpp/lex.c @@ -1062,7 +1062,7 @@ _cpp_clean_line (cpp_reader *pfile) d = (uchar *) s; /* Handle DOS line endings. */ - if (*s == '\r' && s != buffer->rlimit && s[1] == '\n') + if (*s == '\r' && s + 1 != buffer->rlimit && s[1] == '\n') s++; } -- 2.30.2