Module Name:    src
Committed By:   tnozaki
Date:           Sun Mar 28 14:05:09 UTC 2010

Modified Files:
        src/lib/libc/locale: setlocale32.c

Log Message:
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).


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/libc/locale/setlocale32.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/setlocale32.c
diff -u src/lib/libc/locale/setlocale32.c:1.2 src/lib/libc/locale/setlocale32.c:1.3
--- src/lib/libc/locale/setlocale32.c:1.2	Tue Mar 11 17:23:07 2003
+++ src/lib/libc/locale/setlocale32.c	Sun Mar 28 14:05:09 2010
@@ -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);
 }

Reply via email to