Skip site navigation (1)Skip section navigation (2)
Date:      13 Apr 2002 08:35:12 -0000
From:      Yong-Jhen Hong <winard@ritax.dorm.ccu.edu.tw>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   misc/37034: Fixed maximum character length in EUC
Message-ID:  <20020413083512.90043.qmail@ritax.dorm.ccu.edu.tw>

next in thread | raw e-mail | index | archive | help

>Number:         37034
>Category:       misc
>Synopsis:       Fixed maximum character length in EUC
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Apr 13 01:40:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Yong-Jhen Hong
>Release:        FreeBSD 4.5-STABLE i386
>Organization:
N/A
>Environment:
System: FreeBSD ritax.dorm.ccu.edu.tw 4.5-STABLE FreeBSD 4.5-STABLE #0: Tue Mar 19 03:06:46 CST 2002 toor@ritax.dorm.ccu.edu.tw:/usr/obj/usr/src/sys/RITAX i386


>Description:
The EUC rune-related functions use a fixed maximum character length,
which forbids longer multibyte characters.

>How-To-Repeat:
Create a EUC encoding LC_CTYPE locale file which has codeset(s)
longer than three bytes, use mbtowc(3) to convert such multibyte
words.

>Fix:
Apply the following patch:

--- patch-euc begins here ---
--- euc.c       Mon Jun  5 05:47:39 2000
+++ euc.c.new   Thu Mar 28 15:19:02 2002
@@ -82,6 +82,7 @@
                free(rl);
                return (ENOMEM);
        }
+       __mb_cur_max = 0;
        for (x = 0; x < 4; ++x) {
                ei->count[x] = (int) strtol(v, &e, 0);
                if (v == e || !(v = e)) {
@@ -89,6 +90,8 @@
                        free(ei);
                        return (EFTYPE);
                }
+               if (__mb_cur_max < ei->count[x])
+                       __mb_cur_max = ei->count[x];
                while (*v == ' ' || *v == '\t')
                        ++v;
                ei->bits[x] = (int) strtol(v, &e, 0);
@@ -114,7 +117,6 @@
        }
        rl->variable_len = sizeof(_EucInfo);
        _CurrentRuneLocale = rl;
-       __mb_cur_max = 3;
        return (0);
 }

--- patch-euc ends here ---

>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020413083512.90043.qmail>