aboutsummaryrefslogtreecommitdiff
path: root/fs/befs
diff options
context:
space:
mode:
authorJohn W. Linville <linville@tuxdriver.com>2006-08-14 15:33:54 -0400
committerJohn W. Linville <linville@tuxdriver.com>2006-08-14 15:33:54 -0400
commite9ffb3d7ec94083a44a8721681391beca2ffd68c (patch)
tree6768ab487b3f44c2a4995ee61307e47760ca9b88 /fs/befs
parent8b9411014e6f18a883c18b38f41338dbd53fddea (diff)
parente9fa4f7bd291c29a785666e2fa5a9cf3241ee6c3 (diff)
Merge branch 'from-linus' into upstream
Diffstat (limited to 'fs/befs')
-rw-r--r--fs/befs/linuxvfs.c11
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");