From: Apple Date: Sat, 16 Jul 2016 00:12:39 +0000 (+0000) Subject: Libc-1082.50.1.tar.gz X-Git-Tag: os-x-10115^0 X-Git-Url: https://git.saurik.com/apple/libc.git/commitdiff_plain/15de9d6b4ab2de27ae24b13b7b6c4d55fffe4aef?ds=inline Libc-1082.50.1.tar.gz --- diff --git a/locale/FreeBSD/gb18030.c b/locale/FreeBSD/gb18030.c index 7a5fc78..4662465 100644 --- a/locale/FreeBSD/gb18030.c +++ b/locale/FreeBSD/gb18030.c @@ -97,7 +97,7 @@ _GB18030_mbrtowc(wchar_t * __restrict pwc, const char * __restrict s, } ncopy = MIN(MIN(n, GB18030_MB_CUR_MAX), sizeof(gs->bytes) - gs->count); - memcpy(gs->bytes + gs->count, s, ncopy); + strncpy(gs->bytes + gs->count, s, ncopy); ocount = gs->count; gs->count += ncopy; s = (char *)gs->bytes; diff --git a/locale/FreeBSD/gb2312.c b/locale/FreeBSD/gb2312.c index 2803421..559ada4 100644 --- a/locale/FreeBSD/gb2312.c +++ b/locale/FreeBSD/gb2312.c @@ -114,7 +114,7 @@ _GB2312_mbrtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n, } ncopy = MIN(MIN(n, GB2312_MB_CUR_MAX), sizeof(gs->bytes) - gs->count); - memcpy(gs->bytes + gs->count, s, ncopy); + strncpy(gs->bytes + gs->count, s, ncopy); ocount = gs->count; gs->count += ncopy; s = (char *)gs->bytes;