[PATCH 2/7] dosfs: Fix msdos_utf8_normalize_and_fold()

Sebastian Huber sebastian.huber at embedded-brains.de
Tue Mar 14 13:43:27 UTC 2017


It is all right in case the result uses the full destination buffer.
Without this fix the handling of a maximum 8.3 short file name is
broken.

Update #2928.
---
 cpukit/libfs/src/dosfs/msdos_conv_utf8.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/cpukit/libfs/src/dosfs/msdos_conv_utf8.c b/cpukit/libfs/src/dosfs/msdos_conv_utf8.c
index ddf2fdb..cc5c027 100644
--- a/cpukit/libfs/src/dosfs/msdos_conv_utf8.c
+++ b/cpukit/libfs/src/dosfs/msdos_conv_utf8.c
@@ -222,10 +222,10 @@ static int msdos_utf8_normalize_and_fold(
   );
 
   if ( result >= 0 ) {
-    if ( result < unicode_buf_size ) {
+    if ( result <= unicode_buf_size ) {
       unicodes_to_reencode = result;
     } else {
-      unicodes_to_reencode = unicode_buf_size - 1;
+      unicodes_to_reencode = unicode_buf_size;
       eno = ENOMEM;
     }
 
-- 
1.8.4.5




More information about the devel mailing list