Skip to content

Commit

Permalink
nls: utf8_wcstombs: fix buffer overflow
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
cladisch authored and gregkh committed Jun 16, 2009
1 parent e27ecdd commit 905c02a
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions fs/nls/nls_base.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ utf8_wcstombs(__u8 *s, const wchar_t *pwcs, int maxlen)
}
} else {
*op++ = (__u8) *ip;
maxlen--;
}
ip++;
}
Expand Down

0 comments on commit 905c02a

Please sign in to comment.