mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-17 13:50:06 +01:00
Fix memory leak during repeated password entry.
This commit is contained in:
@@ -916,6 +916,9 @@ static int action_open_luks(void)
|
|||||||
r = crypt_activate_by_passphrase(cd, activated_name,
|
r = crypt_activate_by_passphrase(cd, activated_name,
|
||||||
opt_key_slot, password, passwordLen, activate_flags);
|
opt_key_slot, password, passwordLen, activate_flags);
|
||||||
check_signal(&r);
|
check_signal(&r);
|
||||||
|
|
||||||
|
crypt_safe_free(password);
|
||||||
|
password = NULL;
|
||||||
} while ((r == -EPERM || r == -ERANGE) && (--tries > 0));
|
} while ((r == -EPERM || r == -ERANGE) && (--tries > 0));
|
||||||
}
|
}
|
||||||
out:
|
out:
|
||||||
@@ -1358,12 +1361,15 @@ static int action_luksResume(void)
|
|||||||
r = tools_get_key(NULL, &password, &passwordLen,
|
r = tools_get_key(NULL, &password, &passwordLen,
|
||||||
opt_keyfile_offset, opt_keyfile_size, opt_key_file,
|
opt_keyfile_offset, opt_keyfile_size, opt_key_file,
|
||||||
opt_timeout, _verify_passphrase(0), 0, cd);
|
opt_timeout, _verify_passphrase(0), 0, cd);
|
||||||
if (r)
|
if (r < 0)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
r = crypt_resume_by_passphrase(cd, action_argv[0], CRYPT_ANY_SLOT,
|
r = crypt_resume_by_passphrase(cd, action_argv[0], CRYPT_ANY_SLOT,
|
||||||
password, passwordLen);
|
password, passwordLen);
|
||||||
check_signal(&r);
|
check_signal(&r);
|
||||||
|
|
||||||
|
crypt_safe_free(password);
|
||||||
|
password = NULL;
|
||||||
} while ((r == -EPERM || r == -ERANGE) && (--tries > 0));
|
} while ((r == -EPERM || r == -ERANGE) && (--tries > 0));
|
||||||
out:
|
out:
|
||||||
crypt_safe_free(password);
|
crypt_safe_free(password);
|
||||||
|
|||||||
Reference in New Issue
Block a user