summaryrefslogtreecommitdiffstats
path: root/lib/libc/nls/msgcat.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/nls/msgcat.c')
-rw-r--r--lib/libc/nls/msgcat.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/libc/nls/msgcat.c b/lib/libc/nls/msgcat.c
index 1dbdf4f..5a0f9a9 100644
--- a/lib/libc/nls/msgcat.c
+++ b/lib/libc/nls/msgcat.c
@@ -144,6 +144,8 @@ catopen( name, type)
++nlspath;
/* fallthrough */
default:
+ if (pathP - path >= sizeof(path) - 1)
+ goto too_long;
*(pathP++) = *nlspath;
continue;
}
@@ -151,13 +153,17 @@ catopen( name, type)
put_tmpptr:
spcleft = sizeof(path) - (pathP - path) - 1;
if (strlcpy(pathP, tmpptr, spcleft) >= spcleft) {
+ too_long:
free(plang);
free(base);
NLRETERR(ENAMETOOLONG);
}
pathP += strlen(tmpptr);
- } else
+ } else {
+ if (pathP - path >= sizeof(path) - 1)
+ goto too_long;
*(pathP++) = *nlspath;
+ }
}
*pathP = '\0';
if (stat(path, &sbuf) == 0) {
OpenPOWER on IntegriCloud