mirror of
https://github.com/systemd/systemd.git
synced 2024-11-06 16:59:03 +03:00
cryptsetup: fix OOM handling when parsing mount options
This commit is contained in:
parent
cbb13b2a53
commit
4b93637fd7
Notes:
Lennart Poettering
2013-10-04 17:11:46 +02:00
Backport: bugfix
@ -74,7 +74,7 @@ static int parse_one_option(const char *option) {
|
|||||||
|
|
||||||
t = strdup(option+7);
|
t = strdup(option+7);
|
||||||
if (!t)
|
if (!t)
|
||||||
return -ENOMEM;
|
return log_oom();
|
||||||
|
|
||||||
free(opt_cipher);
|
free(opt_cipher);
|
||||||
opt_cipher = t;
|
opt_cipher = t;
|
||||||
@ -89,9 +89,10 @@ static int parse_one_option(const char *option) {
|
|||||||
} else if (startswith(option, "tcrypt-keyfile=")) {
|
} else if (startswith(option, "tcrypt-keyfile=")) {
|
||||||
|
|
||||||
opt_type = CRYPT_TCRYPT;
|
opt_type = CRYPT_TCRYPT;
|
||||||
if (path_is_absolute(option+15))
|
if (path_is_absolute(option+15)) {
|
||||||
opt_tcrypt_keyfiles = strv_append(opt_tcrypt_keyfiles, strdup(option+15));
|
if (strv_extend(&opt_tcrypt_keyfiles, option + 15) < 0)
|
||||||
else
|
return log_oom();
|
||||||
|
} else
|
||||||
log_error("Key file path '%s' is not absolute. Ignoring.", option+15);
|
log_error("Key file path '%s' is not absolute. Ignoring.", option+15);
|
||||||
|
|
||||||
} else if (startswith(option, "keyfile-size=")) {
|
} else if (startswith(option, "keyfile-size=")) {
|
||||||
@ -113,7 +114,7 @@ static int parse_one_option(const char *option) {
|
|||||||
|
|
||||||
t = strdup(option+5);
|
t = strdup(option+5);
|
||||||
if (!t)
|
if (!t)
|
||||||
return -ENOMEM;
|
return log_oom();
|
||||||
|
|
||||||
free(opt_hash);
|
free(opt_hash);
|
||||||
opt_hash = t;
|
opt_hash = t;
|
||||||
|
Loading…
Reference in New Issue
Block a user