Date: Wed, 13 Jan 2016 21:49:01 +0000 (UTC) From: Brooks Davis <brooks@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r293855 - head/lib/libc/string Message-ID: <201601132149.u0DLn1lg017815@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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@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--; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201601132149.u0DLn1lg017815>