Module Name: src Committed By: riz Date: Mon Aug 20 19:27:04 UTC 2012
Modified Files: src/lib/libc/locale [netbsd-6]: rune.c Log Message: Pull up following revision(s) (requested by tnozaki in ticket #518): lib/libc/locale/rune.c: revision 1.44 lib/libc/locale/rune.c: revision 1.45 Restore RCS Id lost in previous. 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. To generate a diff of this commit: cvs rdiff -u -r1.43 -r1.43.2.1 src/lib/libc/locale/rune.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/lib/libc/locale/rune.c diff -u src/lib/libc/locale/rune.c:1.43 src/lib/libc/locale/rune.c:1.43.2.1 --- src/lib/libc/locale/rune.c:1.43 Fri Jan 20 16:31:30 2012 +++ src/lib/libc/locale/rune.c Mon Aug 20 19:27:04 2012 @@ -1,5 +1,4 @@ -/* $NetBSD: rune.c,v 1.43 2012/01/20 16:31:30 joerg Exp $ */ - +/* $NetBSD: rune.c,v 1.43.2.1 2012/08/20 19:27:04 riz Exp $ */ /*- * Copyright (c)2010 Citrus Project, * All rights reserved. @@ -162,7 +161,7 @@ _rune_read_file(const char * __restrict 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 +218,15 @@ do { \ READ_RANGE(maplower); READ_RANGE(mapupper); - memcpy((void *)rune, (void const *)frune, variable_len); - rl->rl_variable_len = variable_len; - rl->rl_variable = (void *)rune; - - if (lenvar > 0) { + 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; + _rune_find_codeset(rlp->rlp_codeset, sizeof(rlp->rlp_codeset), (char *)rl->rl_variable, &rl->rl_variable_len);