Author: pfg
Date: Thu Nov 28 16:36:03 2013
New Revision: 258712
URL: http://svnweb.freebsd.org/changeset/base/258712

Log:
  libcpp: fix an underflow.
  
  Obtained from:        OpenBSD (Rev 1.2)
  MFC after:    2 weeks

Modified:
  head/contrib/gcclibs/libcpp/charset.c

Modified: head/contrib/gcclibs/libcpp/charset.c
==============================================================================
--- head/contrib/gcclibs/libcpp/charset.c       Thu Nov 28 15:28:51 2013        
(r258711)
+++ head/contrib/gcclibs/libcpp/charset.c       Thu Nov 28 16:36:03 2013        
(r258712)
@@ -1628,7 +1628,7 @@ _cpp_convert_input (cpp_reader *pfile, c
      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';
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to