fix driver crash when trying to open files having at least twice as long
file name as allowed by NTFS (crash reported by Bernhard Kaindl)master
parent
6ad4be98f6
commit
5fde1785fd
|
@ -446,9 +446,8 @@ ntfs_inode *ntfs_pathname_to_inode(ntfs_volume *vol, ntfs_inode *parent,
|
|||
}
|
||||
}
|
||||
|
||||
unicode = ntfs_calloc(MAX_PATH);
|
||||
ascii = strdup(pathname);
|
||||
if (!unicode || !ascii) {
|
||||
if (!ascii) {
|
||||
ntfs_log_debug("Out of memory.\n");
|
||||
err = ENOMEM;
|
||||
goto close;
|
||||
|
@ -466,7 +465,7 @@ ntfs_inode *ntfs_pathname_to_inode(ntfs_volume *vol, ntfs_inode *parent,
|
|||
q++;
|
||||
}
|
||||
|
||||
len = ntfs_mbstoucs(p, &unicode, MAX_PATH);
|
||||
len = ntfs_mbstoucs(p, &unicode, 0);
|
||||
if (len < 0) {
|
||||
ntfs_log_debug("Couldn't convert name to Unicode: %s.\n", p);
|
||||
err = errno;
|
||||
|
@ -499,6 +498,9 @@ ntfs_inode *ntfs_pathname_to_inode(ntfs_volume *vol, ntfs_inode *parent,
|
|||
goto close;
|
||||
}
|
||||
|
||||
free(unicode);
|
||||
unicode = NULL;
|
||||
|
||||
p = q;
|
||||
while (p && *p && *p == PATH_SEP)
|
||||
p++;
|
||||
|
|
Loading…
Reference in New Issue