Skip to content
Snippets Groups Projects
Commit cd466606 authored by Brian Carrier's avatar Brian Carrier
Browse files

change to behavior for issue 3303679 and cleanup of short names

parent 00ed3193
Branches
Tags
No related merge requests found
...@@ -263,7 +263,6 @@ attr2mode(uint16_t attr) ...@@ -263,7 +263,6 @@ attr2mode(uint16_t attr)
* @param sect Sector address where directory entry is from -- used * @param sect Sector address where directory entry is from -- used
* to determine allocation status. * to determine allocation status.
* @param inum Address of the inode. * @param inum Address of the inode.
* @param a_isInUnalloc 1 if the file is located in unallocated space and should get more cleanup
* *
* @returns 1 on error and 0 on success. Errors should only occur for * @returns 1 on error and 0 on success. Errors should only occur for
* Unicode conversion problems and when this occurs the name will be * Unicode conversion problems and when this occurs the name will be
...@@ -272,7 +271,7 @@ attr2mode(uint16_t attr) ...@@ -272,7 +271,7 @@ attr2mode(uint16_t attr)
*/ */
static TSK_RETVAL_ENUM static TSK_RETVAL_ENUM
fatfs_dinode_copy(FATFS_INFO * fatfs, TSK_FS_META * fs_meta, fatfs_dinode_copy(FATFS_INFO * fatfs, TSK_FS_META * fs_meta,
fatfs_dentry * in, TSK_DADDR_T sect, TSK_INUM_T inum, uint8_t a_isInUnalloc) fatfs_dentry * in, TSK_DADDR_T sect, TSK_INUM_T inum)
{ {
int retval; int retval;
int i; int i;
...@@ -503,15 +502,13 @@ fatfs_dinode_copy(FATFS_INFO * fatfs, TSK_FS_META * fs_meta, ...@@ -503,15 +502,13 @@ fatfs_dinode_copy(FATFS_INFO * fatfs, TSK_FS_META * fs_meta,
} }
fs_meta->name2->name[i] = '\0'; fs_meta->name2->name[i] = '\0';
/* if in unalloc space, then clean up non-ASCII because we are /* clean up non-ASCII because we are
* copying it into a buffer that is supposed to be UTF-8 and * 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 * we don't know what encoding it is actually in or if it is
* simply junk. */ * simply junk. */
if (a_isInUnalloc) { for (i = 0; fs_meta->name2->name[i] != '\0'; i++) {
for (i = 0; fs_meta->name2->name[i] != '\0'; i++) { if ((unsigned char)(fs_meta->name2->name[i]) > 0x7e) {
if (fs_meta->name2->name[i] > 0x7e) { fs_meta->name2->name[i] = '^';
fs_meta->name2->name[i] = '^';
}
} }
} }
} }
...@@ -1457,7 +1454,7 @@ fatfs_inode_walk(TSK_FS_INFO * fs, TSK_INUM_T start_inum, ...@@ -1457,7 +1454,7 @@ fatfs_inode_walk(TSK_FS_INFO * fs, TSK_INUM_T start_inum,
if ((retval2 = if ((retval2 =
fatfs_dinode_copy(fatfs, fs_file->meta, dep, sect, fatfs_dinode_copy(fatfs, fs_file->meta, dep, sect,
inum, !isInDir)) != TSK_OK) { inum)) != TSK_OK) {
/* Ignore this error and continue */ /* Ignore this error and continue */
if (retval2 == TSK_COR) { if (retval2 == TSK_COR) {
if (tsk_verbose) if (tsk_verbose)
...@@ -1664,7 +1661,7 @@ fatfs_inode_lookup(TSK_FS_INFO * fs, TSK_FS_FILE * a_fs_file, ...@@ -1664,7 +1661,7 @@ fatfs_inode_lookup(TSK_FS_INFO * fs, TSK_FS_FILE * a_fs_file,
if (fatfs_isdentry(fatfs, &dep, 1)) { if (fatfs_isdentry(fatfs, &dep, 1)) {
if ((retval = if ((retval =
fatfs_dinode_copy(fatfs, a_fs_file->meta, &dep, sect, fatfs_dinode_copy(fatfs, a_fs_file->meta, &dep, sect,
inum, 0)) != TSK_OK) { inum)) != TSK_OK) {
/* If there was a unicode conversion error, /* If there was a unicode conversion error,
* then still return the inode */ * then still return the inode */
if (retval == TSK_ERR) { if (retval == TSK_ERR) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment