diff options
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/nls/msgcat.c | 8 |
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) { |