Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libc/locale avoid mbrtowc/wcrtomb buffer overrun when CP...
details: https://anonhg.NetBSD.org/src/rev/27437f6c323a
branches: trunk
changeset: 753431:27437f6c323a
user: tnozaki <tnozaki%NetBSD.org@localhost>
date: Sun Mar 28 14:05:09 2010 +0000
description:
avoid mbrtowc/wcrtomb buffer overrun when CPUARCH=hppa and MB_CUR_MAX > 6.
it is not usual case(merely used such mutibyte locale, eg. ja_JP.ISO-2022-JP).
[background]
before merging minoura-xpg4dl branch(2001), we argued and decided to increase
MB_LEN_MAX 1 -> 32 all CPUARCH(*but* we forgot to change it MD to MI).
without knowing that NetBSD/hp700(mergeing -current 2002) incorrectly set
MB_LEN_MAX=6 (maybe this value taken from FreeBSD). but our setlocale(3)
assumes __mb_len_max_runtime as 32, so that mbrtowc/wcrtomb may overrun.
we have to increase hppa's MB_LEN_MAX upto 32, and change it MD to MI
next libc major bump(scheduled next release 6.0).
diffstat:
lib/libc/locale/setlocale32.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diffs (26 lines):
diff -r b771435e1234 -r 27437f6c323a lib/libc/locale/setlocale32.c
--- a/lib/libc/locale/setlocale32.c Sun Mar 28 13:11:23 2010 +0000
+++ b/lib/libc/locale/setlocale32.c Sun Mar 28 14:05:09 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: setlocale32.c,v 1.2 2003/03/11 17:23:07 tshiozak Exp $ */
+/* $NetBSD: setlocale32.c,v 1.3 2010/03/28 14:05:09 tnozaki Exp $ */
/*-
* Copyright (c)1999 Citrus Project,
@@ -28,7 +28,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: setlocale32.c,v 1.2 2003/03/11 17:23:07 tshiozak Exp $");
+__RCSID("$NetBSD: setlocale32.c,v 1.3 2010/03/28 14:05:09 tnozaki Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
@@ -44,6 +44,6 @@
/* locale may be NULL */
- __mb_len_max_runtime = 32;
+ __mb_len_max_runtime = MB_LEN_MAX;
return __setlocale(category, locale);
}
Home |
Main Index |
Thread Index |
Old Index