From 3f019ed5850cda9d322aebdbed8d8673af0de39f Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Fri, 24 Apr 2009 10:11:56 +0200 Subject: [PATCH] nls: utf8_wcstombs: fix buffer overflow utf8_wcstombs forgot to include one-byte UTF-8 characters when calculating the output buffer size, i.e., theoretically, it was possible to overflow the output buffer with an input string that contains enough ASCII characters. In practice, this was no problem because the only user so far (VFAT) always uses a big enough output buffer. Signed-off-by: Clemens Ladisch Signed-off-by: Greg Kroah-Hartman --- fs/nls/nls_base.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/nls/nls_base.c b/fs/nls/nls_base.c index 000736d89c951..750abf211e260 100644 --- a/fs/nls/nls_base.c +++ b/fs/nls/nls_base.c @@ -150,6 +150,7 @@ utf8_wcstombs(__u8 *s, const wchar_t *pwcs, int maxlen) } } else { *op++ = (__u8) *ip; + maxlen--; } ip++; } -- 2.39.5