From ab5ba3cda2cebfe86047d8c3ee45a0a8a54efa79 Mon Sep 17 00:00:00 2001 From: Diego Calleja Date: Sat, 5 Aug 2006 12:14:55 -0700 Subject: [PATCH] --- yaml --- r: 33247 b: refs/heads/master c: 94f563c426a78c97fc2a377315995e6ec8343872 h: refs/heads/master i: 33245: c95c2cdad12cc3452feae88dba4a830df81f7a49 33243: 4e0577084eb02f8d9808873a5f99278861b320af 33239: fda0c69f2a77c41cb5836ebd7a38b756ac2d0d81 33231: 697604d26a67e2e8e7e2290ef9e98e64796a9253 33215: d8ddba9662e6bf823e752339b74964edd92c5668 v: v3 --- [refs] | 2 +- trunk/fs/befs/linuxvfs.c | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index 0a422c990e2e..6a6af31761ab 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: e31f59ce593b073ee14241781edfb0637697eeb6 +refs/heads/master: 94f563c426a78c97fc2a377315995e6ec8343872 diff --git a/trunk/fs/befs/linuxvfs.c b/trunk/fs/befs/linuxvfs.c index fcaeead9696b..50cfca5c7efd 100644 --- a/trunk/fs/befs/linuxvfs.c +++ b/trunk/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");