diff --git a/tsk3/fs/fatfs_meta.c b/tsk3/fs/fatfs_meta.c index 788eae5f6e808479aaa35f628840d95362a02897..5175867d8a8e0e53ceaf2c0b257d4d0ecedf7d1f 100644 --- a/tsk3/fs/fatfs_meta.c +++ b/tsk3/fs/fatfs_meta.c @@ -471,6 +471,16 @@ fatfs_dinode_copy(FATFS_INFO * fatfs, TSK_FS_META * fs_meta, fs_meta->name2->name[i++] = in->ext[a]; } fs_meta->name2->name[i] = '\0'; + + /* clean up non-ASCII because we are + * copying it into a buffer that is supposed to be UTF-8 and + * we don't know what encoding it is actually in or if it is + * simply junk. */ + for (i = 0; fs_meta->name2->name[i] != '\0'; i++) { + if ((unsigned char)(fs_meta->name2->name[i]) > 0x7e) { + fs_meta->name2->name[i] = '^'; + } + } } /* If the entry is a normal short entry, then copy the name * and add the '.' for the extension