Author: brooks
Date: Wed Jan 20 19:52:01 2016
New Revision: 294456
URL: https://svnweb.freebsd.org/changeset/base/294456

Log:
  MFC r293855:
  
  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>

Modified:
  stable/9/lib/libc/string/wcsncat.c
Directory Properties:
  stable/9/lib/libc/   (props changed)

Modified: stable/9/lib/libc/string/wcsncat.c
==============================================================================
--- stable/9/lib/libc/string/wcsncat.c  Wed Jan 20 19:26:04 2016        
(r294455)
+++ stable/9/lib/libc/string/wcsncat.c  Wed Jan 20 19:52:01 2016        
(r294456)
@@ -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-stable-9@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-9
To unsubscribe, send any mail to "svn-src-stable-9-unsubscr...@freebsd.org"

Reply via email to