Author: brooks
Date: Wed Jan 13 21:49:01 2016
New Revision: 293855
URL: https://svnweb.freebsd.org/changeset/base/293855

Log:
  Avoid reading pass the end of the source buffer when it is not NUL
  terminated.
  
  If this buffer is adjacent to an unmapped page or a version of C with
  bounds checked is used this may result in a crash.
  
  PR:           206177
  Submitted by: Alexander Cherepanov <chere...@mccme.ru>
  MFC after:    1 week

Modified:
  head/lib/libc/string/wcsncat.c

Modified: head/lib/libc/string/wcsncat.c
==============================================================================
--- head/lib/libc/string/wcsncat.c      Wed Jan 13 21:47:27 2016        
(r293854)
+++ head/lib/libc/string/wcsncat.c      Wed Jan 13 21:49:01 2016        
(r293855)
@@ -48,7 +48,7 @@ wcsncat(wchar_t * __restrict s1, const w
                p++;
        q = p;
        r = s2;
-       while (*r && n) {
+       while (n && *r) {
                *q++ = *r++;
                n--;
        }
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to