misc/74743: wctype.c declares static array on stack
knut st. osmundsen
bird-freebsd at anduin.net
Sun Dec 5 13:40:19 PST 2004
>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 at 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:
More information about the freebsd-bugs
mailing list