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:
Jean-Pierre André 2016-06-22 11:58:20 +02:00
parent cf6f265069
commit 5693341f0d

View File

@ -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.