summaryrefslogtreecommitdiffstats
path: root/contrib/gcclibs
diff options
context:
space:
mode:
authorpfg <pfg@FreeBSD.org>2013-11-28 16:36:03 +0000
committerpfg <pfg@FreeBSD.org>2013-11-28 16:36:03 +0000
commitc43b08723006b3696bfacd88c5837816a07ee9b5 (patch)
treea31545ed205eafbfbb61ae2622ce8fa150ae1f68 /contrib/gcclibs
parent031fdfe55b95e0bcae95f6e991b74eac2d2d3104 (diff)
downloadFreeBSD-src-c43b08723006b3696bfacd88c5837816a07ee9b5.zip
FreeBSD-src-c43b08723006b3696bfacd88c5837816a07ee9b5.tar.gz
libcpp: fix an underflow.
Obtained from: OpenBSD (Rev 1.2) MFC after: 2 weeks
Diffstat (limited to 'contrib/gcclibs')
-rw-r--r--contrib/gcclibs/libcpp/charset.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/contrib/gcclibs/libcpp/charset.c b/contrib/gcclibs/libcpp/charset.c
index 78c8981..6361f8c 100644
--- a/contrib/gcclibs/libcpp/charset.c
+++ b/contrib/gcclibs/libcpp/charset.c
@@ -1628,7 +1628,7 @@ _cpp_convert_input (cpp_reader *pfile, const char *input_charset,
terminate with another \r, not an \n, so that we do not mistake
the \r\n sequence for a single DOS line ending and erroneously
issue the "No newline at end of file" diagnostic. */
- if (to.text[to.len - 1] == '\r')
+ if (to.len > 0 && to.text[to.len - 1] == '\r')
to.text[to.len] = '\r';
else
to.text[to.len] = '\n';
OpenPOWER on IntegriCloud