Source-Changes-HG archive

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

[src/trunk]: src/lib/libc/locale fix PR lib/46781 statically compiled bash ma...



details:   https://anonhg.NetBSD.org/src/rev/a97acecb3ff5
branches:  trunk
changeset: 780831:a97acecb3ff5
user:      tnozaki <tnozaki%NetBSD.org@localhost>
date:      Wed Aug 08 18:37:26 2012 +0000

description:
fix PR lib/46781 statically compiled bash makes locale loading fail.
analyzed and  patch provided by enami@ nonaka@ obache@ soda@, thanks.
patch modified by me.

diffstat:

 lib/libc/locale/rune.c |  14 ++++++--------
 1 files changed, 6 insertions(+), 8 deletions(-)

diffs (39 lines):

diff -r dcf6c96475b7 -r a97acecb3ff5 lib/libc/locale/rune.c
--- a/lib/libc/locale/rune.c    Wed Aug 08 16:58:28 2012 +0000
+++ b/lib/libc/locale/rune.c    Wed Aug 08 18:37:26 2012 +0000
@@ -1,5 +1,3 @@
-/* $NetBSD: rune.c,v 1.43 2012/01/20 16:31:30 joerg Exp $ */
-
 /*-
  * Copyright (c)2010 Citrus Project,
  * All rights reserved.
@@ -162,7 +160,7 @@
 
        variable_len = be32toh((uint32_t)frl->frl_variable_len);
 
-       n = (len * sizeof(*fre)) + variable_len;
+       n = len * sizeof(*fre);
        if (lenvar < n)
                return EFTYPE;
        lenvar -= n;
@@ -219,15 +217,15 @@
        READ_RANGE(maplower);
        READ_RANGE(mapupper);
 
+       if (lenvar < variable_len) {
+               ret = EFTYPE;
+               goto err;
+       }
+
        memcpy((void *)rune, (void const *)frune, variable_len);
        rl->rl_variable_len = variable_len;
        rl->rl_variable = (void *)rune;
 
-       if (lenvar > 0) {
-               ret = EFTYPE;
-               goto err;
-       }
-
        _rune_find_codeset(rlp->rlp_codeset, sizeof(rlp->rlp_codeset),
            (char *)rl->rl_variable, &rl->rl_variable_len);
 



Home | Main Index | Thread Index | Old Index