From: Clemens Ladisch Date: Fri, 24 Apr 2009 08:11:40 +0000 (+0200) Subject: nls: utf8_wcstombs: use correct buffer size in error case X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=e27ecdd94d81e5bc3d1f68591701db5adb342f0d;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git nls: utf8_wcstombs: use correct buffer size in error case When utf8_wcstombs encounters a character that cannot be encoded, we must not decrease the remaining output buffer size because nothing has been written to the output buffer. Signed-off-by: Clemens Ladisch Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/nls/nls_base.c b/fs/nls/nls_base.c index 9b0efdad8910..000736d89c95 100644 --- a/fs/nls/nls_base.c +++ b/fs/nls/nls_base.c @@ -144,7 +144,6 @@ utf8_wcstombs(__u8 *s, const wchar_t *pwcs, int maxlen) size = utf8_wctomb(op, *ip, maxlen); if (size == -1) { /* Ignore character and move on */ - maxlen--; } else { op += size; maxlen -= size;