cryptsetup: avoid state leaks from ignored options (#43135)
This commit is contained in:
@@ -193,19 +193,20 @@ static int parse_one_option(const char *option) {
|
||||
return log_oom();
|
||||
|
||||
} else if ((val = startswith(option, "size="))) {
|
||||
unsigned key_size;
|
||||
|
||||
r = safe_atou(val, &arg_key_size);
|
||||
r = safe_atou(val, &key_size);
|
||||
if (r < 0) {
|
||||
log_warning_errno(r, "Failed to parse %s, ignoring: %m", option);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (arg_key_size % 8) {
|
||||
if (key_size % 8) {
|
||||
log_warning("size= not a multiple of 8, ignoring.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
arg_key_size /= 8;
|
||||
arg_key_size = key_size / 8;
|
||||
|
||||
} else if ((val = startswith(option, "sector-size="))) {
|
||||
|
||||
@@ -310,8 +311,6 @@ static int parse_one_option(const char *option) {
|
||||
SET_FLAG(arg_ask_password_flags, ASK_PASSWORD_SILENT, !r);
|
||||
}
|
||||
} else if ((val = startswith(option, "password-cache="))) {
|
||||
arg_password_cache_set = true;
|
||||
|
||||
if (streq(val, "read-only")) {
|
||||
arg_ask_password_flags |= ASK_PASSWORD_ACCEPT_CACHED;
|
||||
arg_ask_password_flags &= ~ASK_PASSWORD_PUSH_CACHE;
|
||||
@@ -324,6 +323,8 @@ static int parse_one_option(const char *option) {
|
||||
|
||||
SET_FLAG(arg_ask_password_flags, ASK_PASSWORD_ACCEPT_CACHED|ASK_PASSWORD_PUSH_CACHE, r);
|
||||
}
|
||||
|
||||
arg_password_cache_set = true;
|
||||
} else if (STR_IN_SET(option, "allow-discards", "discard"))
|
||||
arg_discards = true;
|
||||
else if (streq(option, "same-cpu-crypt"))
|
||||
|
||||
Reference in New Issue
Block a user