Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 5 Dec 2004 21:36:14 GMT
From:      "knut st. osmundsen" <bird-freebsd@anduin.net>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   misc/74743: wctype.c declares static array on stack
Message-ID:  <200412052136.iB5LaE2P005542@www.freebsd.org>
Resent-Message-ID: <200412052140.iB5LeIEG005653@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         74743
>Category:       misc
>Synopsis:       wctype.c declares static array on stack
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Dec 05 21:40:18 GMT 2004
>Closed-Date:
>Last-Modified:
>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:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200412052136.iB5LaE2P005542>