chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
cbb13b2
)
cryptsetup: fix OOM handling when parsing mount options
author
Lennart Poettering
<lennart@poettering.net>
Wed, 2 Oct 2013 17:36:28 +0000
(19:36 +0200)
committer
Lennart Poettering
<lennart@poettering.net>
Wed, 2 Oct 2013 17:45:12 +0000
(19:45 +0200)
src/cryptsetup/cryptsetup.c
patch
|
blob
|
history
diff --git
a/src/cryptsetup/cryptsetup.c
b/src/cryptsetup/cryptsetup.c
index 22b5eead72d3e804557e602090f86cb781734527..769c3e4f3165fa198c04f6a70ee7c95e06af75a3 100644
(file)
--- a/
src/cryptsetup/cryptsetup.c
+++ b/
src/cryptsetup/cryptsetup.c
@@
-74,7
+74,7
@@
static int parse_one_option(const char *option) {
t = strdup(option+7);
if (!t)
t = strdup(option+7);
if (!t)
- return
-ENOMEM
;
+ return
log_oom()
;
free(opt_cipher);
opt_cipher = t;
free(opt_cipher);
opt_cipher = t;
@@
-89,9
+89,10
@@
static int parse_one_option(const char *option) {
} else if (startswith(option, "tcrypt-keyfile=")) {
opt_type = CRYPT_TCRYPT;
} else if (startswith(option, "tcrypt-keyfile=")) {
opt_type = CRYPT_TCRYPT;
- if (path_is_absolute(option+15))
- opt_tcrypt_keyfiles = strv_append(opt_tcrypt_keyfiles, strdup(option+15));
- else
+ if (path_is_absolute(option+15)) {
+ if (strv_extend(&opt_tcrypt_keyfiles, option + 15) < 0)
+ return log_oom();
+ } else
log_error("Key file path '%s' is not absolute. Ignoring.", option+15);
} else if (startswith(option, "keyfile-size=")) {
log_error("Key file path '%s' is not absolute. Ignoring.", option+15);
} else if (startswith(option, "keyfile-size=")) {
@@
-113,7
+114,7
@@
static int parse_one_option(const char *option) {
t = strdup(option+5);
if (!t)
t = strdup(option+5);
if (!t)
- return
-ENOMEM
;
+ return
log_oom()
;
free(opt_hash);
opt_hash = t;
free(opt_hash);
opt_hash = t;