summaryrefslogtreecommitdiff
path: root/src/locale/dcngettext.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/locale/dcngettext.c')
-rw-r--r--src/locale/dcngettext.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/locale/dcngettext.c b/src/locale/dcngettext.c
index 51e6522a..d3462fd2 100644
--- a/src/locale/dcngettext.c
+++ b/src/locale/dcngettext.c
@@ -229,8 +229,9 @@ notrans:
unsigned long plural = __pleval(p->plural_rule, n);
if (plural > p->nplurals) goto notrans;
while (plural--) {
- size_t l = strlen(trans);
- if (l+1 >= p->map_size - (trans - (char *)p->map))
+ size_t rem = p->map_size - (trans - (char *)p->map);
+ size_t l = strnlen(trans, rem);
+ if (l+1 >= rem)
goto notrans;
trans += l+1;
}