Skip to content

Commit

Permalink
nls: utf8_wcstombs: use correct buffer size in error case
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
cladisch authored and gregkh committed Jun 16, 2009
1 parent 97d7b7a commit e27ecdd
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion fs/nls/nls_base.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit e27ecdd

Please sign in to comment.