Author: brooks
Date: Wed Jan 20 19:56:43 2016
New Revision: 294457
URL: https://svnweb.freebsd.org/changeset/base/294457

Log:
  MFC r293856:
  
  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:           206178
  Submitted by: Alexander Cherepanov <chere...@mccme.ru>

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

Modified: stable/9/lib/libc/string/wcslcat.c
==============================================================================
--- stable/9/lib/libc/string/wcslcat.c  Wed Jan 20 19:52:01 2016        
(r294456)
+++ stable/9/lib/libc/string/wcslcat.c  Wed Jan 20 19:56:43 2016        
(r294457)
@@ -54,7 +54,7 @@ wcslcat(wchar_t *dst, const wchar_t *src
        size_t dlen;
 
        /* Find the end of dst and adjust bytes left but don't go past end */
-       while (*d != '\0' && n-- != 0)
+       while (n-- != 0 && *d != '\0')
                d++;
        dlen = d - dst;
        n = siz - dlen;
_______________________________________________
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