Fix braino in previous: check that the second byte in the character
buffer is non-null when the character is two bytes long, not when the buffer is two bytes long.
This commit is contained in:
parent
4cec015da7
commit
f789f94dbb
@ -118,7 +118,7 @@ _BIG5_mbrtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n,
|
||||
if (n == 0 || (size_t)(len = _big5_check(*s)) > n)
|
||||
/* Incomplete multibyte sequence */
|
||||
return ((size_t)-2);
|
||||
if (n == 2 && s[1] == '\0') {
|
||||
if (len == 2 && s[1] == '\0') {
|
||||
errno = EILSEQ;
|
||||
return ((size_t)-1);
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ _GBK_mbrtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n,
|
||||
if (n == 0 || (size_t)(len = _gbk_check(*s)) > n)
|
||||
/* Incomplete multibyte sequence */
|
||||
return ((size_t)-2);
|
||||
if (n == 2 && s[1] == '\0') {
|
||||
if (len == 2 && s[1] == '\0') {
|
||||
errno = EILSEQ;
|
||||
return ((size_t)-1);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user