summaryrefslogtreecommitdiff
path: root/lib/libc
diff options
context:
space:
mode:
authorKris Kennaway <kris@FreeBSD.org>2000-08-05 04:56:43 +0000
committerKris Kennaway <kris@FreeBSD.org>2000-08-05 04:56:43 +0000
commit84b578d5628929b4c05e577edc7ea15f8e3e408a (patch)
treea4aa906f0e00900bfc93138e8f12c8b9f342c605 /lib/libc
parentab9e9f9d2df56c5a066d1086939cf350aa685422 (diff)
Notes
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/nls/msgcat.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/libc/nls/msgcat.c b/lib/libc/nls/msgcat.c
index f1355df0be47..ee97058b4690 100644
--- a/lib/libc/nls/msgcat.c
+++ b/lib/libc/nls/msgcat.c
@@ -91,8 +91,9 @@ int type;
__const char *catpath = NULL;
char *nlspath;
char *lang;
- long len;
char *base, *cptr, *pathP;
+ int spcleft;
+ long len;
struct stat sbuf;
if (!name || !*name) {
@@ -129,13 +130,20 @@ int type;
*cptr = '\0';
for (pathP = path; *nlspath; ++nlspath) {
if (*nlspath == '%') {
+ spcleft = sizeof(path) - (pathP - path);
if (*(nlspath + 1) == 'L') {
++nlspath;
- strcpy(pathP, lang);
+ if (strlcpy(pathP, lang, spcleft) >= spcleft) {
+ errno = ENAMETOOLONG;
+ return(NLERR);
+ }
pathP += strlen(lang);
} else if (*(nlspath + 1) == 'N') {
++nlspath;
- strcpy(pathP, name);
+ if (strlcpy(pathP, name, spcleft) >= spcleft) {
+ errno = ENAMETOOLONG;
+ return(NLERR);
+ }
pathP += strlen(name);
} else *(pathP++) = *nlspath;
} else *(pathP++) = *nlspath;