aboutsummaryrefslogtreecommitdiff
path: root/libcpp
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@acm.org>2020-11-03 08:32:42 -0800
committerNathan Sidwell <nathan@acm.org>2020-11-03 08:49:25 -0800
commit082a7b239096caf422f7ef138e2729b2730c0d70 (patch)
treea7a40c40dde548a75932a4ff8199d5fc1075d954 /libcpp
parent84ed8d2c88966fe30c54802a2088f68495fd833a (diff)
downloadgcc-082a7b239096caf422f7ef138e2729b2730c0d70.zip
gcc-082a7b239096caf422f7ef138e2729b2730c0d70.tar.gz
gcc-082a7b239096caf422f7ef138e2729b2730c0d70.tar.bz2
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.
Diffstat (limited to 'libcpp')
-rw-r--r--libcpp/lex.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libcpp/lex.c b/libcpp/lex.c
index fb22292..1d52203 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++;
}