From nobody@FreeBSD.org  Sun Dec  5 21:36:15 2004
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 282E616A4DC
	for <freebsd-gnats-submit@FreeBSD.org>; Sun,  5 Dec 2004 21:36:15 +0000 (GMT)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 1904B43D1D
	for <freebsd-gnats-submit@FreeBSD.org>; Sun,  5 Dec 2004 21:36:15 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id iB5LaEPb005543
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 5 Dec 2004 21:36:14 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id iB5LaE2P005542;
	Sun, 5 Dec 2004 21:36:14 GMT
	(envelope-from nobody)
Message-Id: <200412052136.iB5LaE2P005542@www.freebsd.org>
Date: Sun, 5 Dec 2004 21:36:14 GMT
From: "knut st. osmundsen" <bird-freebsd@anduin.net>
To: freebsd-gnats-submit@FreeBSD.org
Subject: wctype.c declares static array on stack
X-Send-Pr-Version: www-2.3

>Number:         74743
>Category:       bin
>Synopsis:       [patch] wctype.c declares static array on stack
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    antoine
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Dec 05 21:40:18 GMT 2004
>Closed-Date:    Sat Apr 26 17:54:16 UTC 2008
>Last-Modified:  Sat Apr 26 17:54:16 UTC 2008
>Originator:     knut st. osmundsen
>Release:        5.3
>Organization:
>Environment:
FreeBSD anduin.net 5.3-STABLE FreeBSD 5.3-STABLE #1: Thu Oct 21 23:08:04 CEST 2004     root@anduin.net:/usr/obj/usr/src/sys/ANDUIN  amd64
>Description:
The prop array in int wctype() implementation is instanciated on the stack every call.

Sorry if this should be posted elsewhere, but this is my first time on sending a patch. I just happen to come across the code when I shopping code for a OS/2 libc.
>How-To-Repeat:
Call wctype().
>Fix:
Index: wctype.c
===================================================================
RCS file: /home/ncvs/src/lib/libc/locale/wctype.c,v
retrieving revision 1.3
diff -u -5 -r1.3 wctype.c
--- wctype.c    27 Mar 2004 08:59:21 -0000      1.3
+++ wctype.c    5 Dec 2004 21:27:26 -0000
@@ -40,11 +40,11 @@
 }

 wctype_t
 wctype(const char *property)
 {
-       struct {
+       static const struct {
                const char      *name;
                wctype_t         mask;
        } props[] = {
                { "alnum",      _CTYPE_A|_CTYPE_D },
                { "alpha",      _CTYPE_A },

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->antoine 
Responsible-Changed-By: antoine 
Responsible-Changed-When: Wed Mar 12 18:29:29 UTC 2008 
Responsible-Changed-Why:  
Take. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=74743 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/74743: commit references a PR
Date: Mon, 17 Mar 2008 18:22:31 +0000 (UTC)

 antoine     2008-03-17 18:22:23 UTC
 
   FreeBSD src repository
 
   Modified files:
     lib/libc/locale      wctype.c 
   Log:
   Don't allocate the constant array "props" on the stack in wctype.
   
   PR:             74743
   Submitted by:   knut st. osmundsen
   Approved by:    rwatson (mentor)
   MFC after:      1 month
   
   Revision  Changes    Path
   1.4       +1 -1      src/lib/libc/locale/wctype.c
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: open->patched 
State-Changed-By: antoine 
State-Changed-When: Mon Mar 17 18:42:00 UTC 2008 
State-Changed-Why:  
Patched in HEAD, thanks. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=74743 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/74743: commit references a PR
Date: Sat, 26 Apr 2008 17:38:11 +0000 (UTC)

 antoine     2008-04-26 17:38:07 UTC
 
   FreeBSD src repository
 
   Modified files:        (Branch: RELENG_7)
     lib/libc/locale      wctype.c 
   Log:
   MFC to RELENG_7:
     Don't allocate the constant array "props" on the stack in wctype.
   
     PR:             74743
     Submitted by:   knut st. osmundsen
     Approved by:    rwatson (mentor)
     MFC after:      1 month
   
   Revision  Changes    Path
   1.3.18.1  +1 -1      src/lib/libc/locale/wctype.c
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/74743: commit references a PR
Date: Sat, 26 Apr 2008 17:40:02 +0000 (UTC)

 antoine     2008-04-26 17:39:55 UTC
 
   FreeBSD src repository
 
   Modified files:        (Branch: RELENG_6)
     lib/libc/locale      wctype.c 
   Log:
   MFC to RELENG_6:
     Don't allocate the constant array "props" on the stack in wctype.
   
     PR:             74743
     Submitted by:   knut st. osmundsen
     Approved by:    rwatson (mentor)
     MFC after:      1 month
   
   Revision  Changes    Path
   1.3.8.1   +1 -1      src/lib/libc/locale/wctype.c
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: patched->closed 
State-Changed-By: antoine 
State-Changed-When: Sat Apr 26 17:53:16 UTC 2008 
State-Changed-Why:  
Close: fix committed in HEAD, RELENG_7 and RELENG_6. 
Thanks for the report! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=74743 
>Unformatted:
