summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorbrooks <brooks@FreeBSD.org>2016-01-20 19:26:04 +0000
committerbrooks <brooks@FreeBSD.org>2016-01-20 19:26:04 +0000
commit6ef41be39c6d896d6c5919661540ce76614b6e9e (patch)
tree54dd9454264e20b8a8a7b8001c564e44b646565e /lib
parentb0b221cc1e6bae709580b9aceb2384f65661d757 (diff)
downloadFreeBSD-src-6ef41be39c6d896d6c5919661540ce76614b6e9e.zip
FreeBSD-src-6ef41be39c6d896d6c5919661540ce76614b6e9e.tar.gz
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 <cherepan@mccme.ru>
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/string/wcslcat.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/libc/string/wcslcat.c b/lib/libc/string/wcslcat.c
index f5f1e1e..2df9477 100644
--- a/lib/libc/string/wcslcat.c
+++ b/lib/libc/string/wcslcat.c
@@ -54,7 +54,7 @@ wcslcat(wchar_t *dst, const wchar_t *src, size_t siz)
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;
OpenPOWER on IntegriCloud