This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.
Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Hi! E.g. dcgettext("foo", "bar", -32) would segfault... 2002-08-30 Jakub Jelinek <jakub@redhat.com> * intl/dcigettext.c: Include localeinfo.h. (dcigettext): Check for invalid category values. (category_to_name): Use _nl_category_names. --- libc/intl/dcigettext.c.jj 2002-08-05 08:44:15.000000000 +0200 +++ libc/intl/dcigettext.c 2002-08-30 19:57:24.000000000 +0200 @@ -69,6 +69,10 @@ extern int errno; # include <sys/param.h> #endif +#ifdef _LIBC +# include <locale/localeinfo.h> +#endif + #include "gettextP.h" #include "plural-exp.h" #ifdef _LIBC @@ -391,6 +395,16 @@ DCIGETTEXT (domainname, msgid1, msgid2, if (msgid1 == NULL) return NULL; + if (category == LC_ALL +#ifdef _LIBC + || category >= (unsigned) __LC_LAST +#endif + ) + return (plural == 0 + ? (char *) msgid1 + /* Use the Germanic plural rule. */ + : n == 1 ? (char *) msgid1 : (char *) msgid2); + __libc_rwlock_rdlock (_nl_state_lock); /* If DOMAINNAME is NULL, we are interested in the default domain. If @@ -992,6 +1006,9 @@ internal_function category_to_name (category) int category; { +#ifdef _LIBC + return _nl_category_names[category]; +#else const char *retval; switch (category) @@ -1044,6 +1061,7 @@ category_to_name (category) } return retval; +#endif } /* Guess value of current locale from value of the environment variables. */ Jakub
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |