svn commit: r293855 - head/lib/libc/string

Brooks Davis brooks at FreeBSD.org
Wed Jan 13 21:49:02 UTC 2016


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 <cherepan at 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--;
 	}


More information about the svn-src-all mailing list