diff options
| author | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2006-08-27 21:59:59 -0500 |
|---|---|---|
| committer | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2006-08-27 21:59:59 -0500 |
| commit | 8ce7a9c159c8c4eb480f0a65c6af753dbf9a1a70 (patch) | |
| tree | be59573c0af3617d0cd8a7d61f0ed119e58b1156 /fs/befs/linuxvfs.c | |
| parent | d2afb3ae04e36dbc6e9eb2d8bd54406ff7b6b3bd (diff) | |
| parent | 01da5fd83d6b2c5e36b77539f6cbdd8f49849225 (diff) | |
Merge ../linux-2.6
Diffstat (limited to 'fs/befs/linuxvfs.c')
| -rw-r--r-- | fs/befs/linuxvfs.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c index fcaeead9696..50cfca5c7ef 100644 --- a/fs/befs/linuxvfs.c +++ b/fs/befs/linuxvfs.c @@ -512,7 +512,11 @@ befs_utf2nls(struct super_block *sb, const char *in, wchar_t uni; int unilen, utflen; char *result; - int maxlen = in_len; /* The utf8->nls conversion can't make more chars */ + /* The utf8->nls conversion won't make the final nls string bigger + * than the utf one, but if the string is pure ascii they'll have the + * same width and an extra char is needed to save the additional \0 + */ + int maxlen = in_len + 1; befs_debug(sb, "---> utf2nls()"); @@ -588,7 +592,10 @@ befs_nls2utf(struct super_block *sb, const char *in, wchar_t uni; int unilen, utflen; char *result; - int maxlen = 3 * in_len; + /* There're nls characters that will translate to 3-chars-wide UTF-8 + * characters, a additional byte is needed to save the final \0 + * in special cases */ + int maxlen = (3 * in_len) + 1; befs_debug(sb, "---> nls2utf()\n"); |
