diff options
author | ache <ache@FreeBSD.org> | 1997-02-06 09:11:06 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 1997-02-06 09:11:06 +0000 |
commit | 1fbffa765c7c52ab4eb89108096c207c562589d6 (patch) | |
tree | 884ff88fa55071e0b114b7047342a5e92e455a11 /lib/libc/locale/setrunelocale.c | |
parent | b7c9a718d55bb2dfd777c2f469f9a99c4cceae19 (diff) | |
download | FreeBSD-src-1fbffa765c7c52ab4eb89108096c207c562589d6.zip FreeBSD-src-1fbffa765c7c52ab4eb89108096c207c562589d6.tar.gz |
Use symbolic constants instead of hardcoded digits
Add range check for setrunelocale since it can be called
directly.
Remove _startup_setlocale compatibility function
Should go into 2.2
Diffstat (limited to 'lib/libc/locale/setrunelocale.c')
-rw-r--r-- | lib/libc/locale/setrunelocale.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/libc/locale/setrunelocale.c b/lib/libc/locale/setrunelocale.c index 4297206..d422e39 100644 --- a/lib/libc/locale/setrunelocale.c +++ b/lib/libc/locale/setrunelocale.c @@ -40,8 +40,7 @@ #include <string.h> #include <stdio.h> #include <stdlib.h> - -char *_PathLocale; +#include "setlocale.h" extern int _none_init __P((_RuneLocale *)); #ifdef XPG4 @@ -72,7 +71,7 @@ _xpg4_setrunelocale(encoding) char name[PATH_MAX]; _RuneLocale *rl; - if (!encoding) + if (!encoding || strlen(encoding) > ENCODING_LEN) return(EFAULT); /* @@ -85,7 +84,7 @@ _xpg4_setrunelocale(encoding) if (!_PathLocale) _PathLocale = _PATH_LOCALE; - /* Range checking not needed, encoding has fixed size */ + /* Range checking not needed, encoding length already checked above */ (void) strcpy(name, _PathLocale); (void) strcat(name, "/"); (void) strcat(name, encoding); |