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:
Tim J. Robbins 2004-05-13 03:08:28 +00:00
parent 4cec015da7
commit f789f94dbb
2 changed files with 2 additions and 2 deletions

View File

@ -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);
}

View File

@ -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);
}