mirror of
https://git.code.sf.net/p/ntfs-3g/ntfs-3g.git
synced 2024-11-23 10:04:00 +08:00
Fixed ntfs_delete() failure caused by string conversion error
It was possible for ntfs_attr_name_get() to set errno due to a wide character string that could not be converted to a multibyte string. This caused ntfs_delete() to fail. Fix by checking for a nonzero return value specifically from ntfs_attr_lookup(), rather than assuming that nothing else sets errno. Signed-off-by: Eric Biggers <ebiggers3@gmail.com>
This commit is contained in:
parent
cf6f265069
commit
5693341f0d
@ -1904,12 +1904,11 @@ int ntfs_delete(ntfs_volume *vol, const char *pathname,
|
||||
if (!actx)
|
||||
goto err_out;
|
||||
search:
|
||||
while (!ntfs_attr_lookup(AT_FILE_NAME, AT_UNNAMED, 0, CASE_SENSITIVE,
|
||||
0, NULL, 0, actx)) {
|
||||
while (!(err = ntfs_attr_lookup(AT_FILE_NAME, AT_UNNAMED, 0,
|
||||
CASE_SENSITIVE, 0, NULL, 0, actx))) {
|
||||
char *s;
|
||||
IGNORE_CASE_BOOL case_sensitive = IGNORE_CASE;
|
||||
|
||||
errno = 0;
|
||||
fn = (FILE_NAME_ATTR*)((u8*)actx->attr +
|
||||
le16_to_cpu(actx->attr->value_offset));
|
||||
s = ntfs_attr_name_get(fn->file_name, fn->file_name_length);
|
||||
@ -1958,7 +1957,7 @@ search:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (errno) {
|
||||
if (err) {
|
||||
/*
|
||||
* If case sensitive search failed, then try once again
|
||||
* ignoring case.
|
||||
|
Loading…
Reference in New Issue
Block a user