Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/citrus/modules _citrus_MSKanji_wcrtomb_priv: return...



details:   https://anonhg.NetBSD.org/src/rev/58b0bd1c39b3
branches:  trunk
changeset: 556896:58b0bd1c39b3
user:      yamt <yamt%NetBSD.org@localhost>
date:      Mon Dec 29 17:59:03 2003 +0000

description:
_citrus_MSKanji_wcrtomb_priv: return E2BIG correctly.

diffstat:

 lib/libc/citrus/modules/citrus_mskanji.c |  9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diffs (30 lines):

diff -r 708b7c146552 -r 58b0bd1c39b3 lib/libc/citrus/modules/citrus_mskanji.c
--- a/lib/libc/citrus/modules/citrus_mskanji.c  Mon Dec 29 17:49:22 2003 +0000
+++ b/lib/libc/citrus/modules/citrus_mskanji.c  Mon Dec 29 17:59:03 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: citrus_mskanji.c,v 1.7 2003/06/26 12:09:58 tshiozak Exp $      */
+/*     $NetBSD: citrus_mskanji.c,v 1.8 2003/12/29 17:59:03 yamt Exp $  */
 
 /*-
  * Copyright (c)2002 Citrus Project,
@@ -62,7 +62,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: citrus_mskanji.c,v 1.7 2003/06/26 12:09:58 tshiozak Exp $");
+__RCSID("$NetBSD: citrus_mskanji.c,v 1.8 2003/12/29 17:59:03 yamt Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include <assert.h>
@@ -297,6 +297,11 @@
                *nresult = 2;
                return 0;
        } else {
+               if (n < 1) {
+                       ret = E2BIG;
+                       goto err;
+               }
+
                s[0] = wc & 0xff;
                if (_mskanji1(s[0] & 0xff)) {
                        ret = EILSEQ;



Home | Main Index | Thread Index | Old Index