forked from Imagelibrary/rtems
dosfs: Fix msdos_utf8_normalize_and_fold()
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. Close #2928.
This commit is contained in:
@@ -222,10 +222,10 @@ static int msdos_utf8_normalize_and_fold(
|
|||||||
);
|
);
|
||||||
|
|
||||||
if ( result >= 0 ) {
|
if ( result >= 0 ) {
|
||||||
if ( result < unicode_buf_size ) {
|
if ( result <= unicode_buf_size ) {
|
||||||
unicodes_to_reencode = result;
|
unicodes_to_reencode = result;
|
||||||
} else {
|
} else {
|
||||||
unicodes_to_reencode = unicode_buf_size - 1;
|
unicodes_to_reencode = unicode_buf_size;
|
||||||
eno = ENOMEM;
|
eno = ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1087,6 +1087,23 @@ static void test_end_of_string_matches( void )
|
|||||||
rtems_test_assert( rc == 0 );
|
rtems_test_assert( rc == 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void test_full_8_3_name( void )
|
||||||
|
{
|
||||||
|
int rc;
|
||||||
|
|
||||||
|
rc = mkdir( MOUNT_DIR "/txtvsbin.txt", S_IRWXU | S_IRWXG | S_IRWXO );
|
||||||
|
rtems_test_assert( rc == 0 );
|
||||||
|
|
||||||
|
rc = unlink( MOUNT_DIR "/txtvsbin.txt" );
|
||||||
|
rtems_test_assert( rc == 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
static void test_special_cases( void )
|
||||||
|
{
|
||||||
|
test_end_of_string_matches();
|
||||||
|
test_full_8_3_name();
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Main test method
|
* Main test method
|
||||||
*/
|
*/
|
||||||
@@ -1145,7 +1162,7 @@ static void test( void )
|
|||||||
"/dev/rdb",
|
"/dev/rdb",
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
test_end_of_string_matches();
|
test_special_cases();
|
||||||
|
|
||||||
rc = unmount( MOUNT_DIR );
|
rc = unmount( MOUNT_DIR );
|
||||||
rtems_test_assert( rc == 0 );
|
rtems_test_assert( rc == 0 );
|
||||||
@@ -1215,7 +1232,7 @@ static void test( void )
|
|||||||
"/dev/rdb",
|
"/dev/rdb",
|
||||||
&mount_opts[1]);
|
&mount_opts[1]);
|
||||||
|
|
||||||
test_end_of_string_matches();
|
test_special_cases();
|
||||||
|
|
||||||
rc = unmount( MOUNT_DIR );
|
rc = unmount( MOUNT_DIR );
|
||||||
rtems_test_assert( rc == 0 );
|
rtems_test_assert( rc == 0 );
|
||||||
@@ -1280,7 +1297,7 @@ static void test( void )
|
|||||||
"/dev/rdc",
|
"/dev/rdc",
|
||||||
&mount_opts[1]);
|
&mount_opts[1]);
|
||||||
|
|
||||||
test_end_of_string_matches();
|
test_special_cases();
|
||||||
|
|
||||||
rc = unmount( MOUNT_DIR );
|
rc = unmount( MOUNT_DIR );
|
||||||
rtems_test_assert( rc == 0 );
|
rtems_test_assert( rc == 0 );
|
||||||
|
|||||||
Reference in New Issue
Block a user