diff options
author | Tim J. Robbins <tjr@FreeBSD.org> | 2004-05-13 03:08:28 +0000 |
---|---|---|
committer | Tim J. Robbins <tjr@FreeBSD.org> | 2004-05-13 03:08:28 +0000 |
commit | f789f94dbbb4d47bb2624aa2ace6e87eec649374 (patch) | |
tree | 7ac11e007b3c2391a38807e1ca6bdd9eceae4530 /lib | |
parent | 4cec015da7b0175ce8c935a5b1034f8095647697 (diff) | |
download | src-f789f94dbbb4d47bb2624aa2ace6e87eec649374.tar.gz src-f789f94dbbb4d47bb2624aa2ace6e87eec649374.zip |
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.
Notes
Notes:
svn path=/head/; revision=129166
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/locale/big5.c | 2 | ||||
-rw-r--r-- | lib/libc/locale/gbk.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/lib/libc/locale/big5.c b/lib/libc/locale/big5.c index 8eb4b522bc76..9e7f1f2baaf0 100644 --- a/lib/libc/locale/big5.c +++ b/lib/libc/locale/big5.c @@ -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); } diff --git a/lib/libc/locale/gbk.c b/lib/libc/locale/gbk.c index 2038720fa09c..d2f32c19d19e 100644 --- a/lib/libc/locale/gbk.c +++ b/lib/libc/locale/gbk.c @@ -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); } |