]> git.saurik.com Git - apple/libc.git/commitdiff
Libc-1082.50.1.tar.gz os-x-10115 v1082.50.1
authorApple <opensource@apple.com>
Sat, 16 Jul 2016 00:12:39 +0000 (00:12 +0000)
committerApple <opensource@apple.com>
Sat, 16 Jul 2016 00:12:39 +0000 (00:12 +0000)
locale/FreeBSD/gb18030.c
locale/FreeBSD/gb2312.c

index 7a5fc7884667419abd4eafa0dacf5c83a16c46db..46624658710ee438937ddf794238b775bfc655d0 100644 (file)
@@ -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);
        }
 
        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;
        ocount = gs->count;
        gs->count += ncopy;
        s = (char *)gs->bytes;
index 28034214c22ad6862791d3409979a12f0a1659a8..559ada45e35cac1b8a43be0c86c5a2c25a089a8d 100644 (file)
@@ -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);
        }
 
        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;
        ocount = gs->count;
        gs->count += ncopy;
        s = (char *)gs->bytes;