Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 22 Jan 2016 00:08:16 +0000 (UTC)
From:      Brooks Davis <brooks@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r294537 - stable/8/lib/libc/string
Message-ID:  <201601220008.u0M08Grs037259@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: brooks
Date: Fri Jan 22 00:08:16 2016
New Revision: 294537
URL: https://svnweb.freebsd.org/changeset/base/294537

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 <cherepan@mccme.ru>
  Requested by:	danfe

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

Modified: stable/8/lib/libc/string/wcsncat.c
==============================================================================
--- stable/8/lib/libc/string/wcsncat.c	Thu Jan 21 22:53:12 2016	(r294536)
+++ stable/8/lib/libc/string/wcsncat.c	Fri Jan 22 00:08:16 2016	(r294537)
@@ -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--;
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201601220008.u0M08Grs037259>