summaryrefslogtreecommitdiffstats
path: root/bin/ykfde.c
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2018-01-19 09:04:35 +0100
committerGravatar Christian Hesse <mail@eworm.de>2018-01-19 09:04:35 +0100
commitb40e86039521736575be726992380bf1079e34e9 (patch)
treea79fe87211d5c6299e1374befcd2e1c777c975b2 /bin/ykfde.c
parent38f9628427040dbea9e651854adaae6897b1dcc2 (diff)
downloadmkinitcpio-ykfde-b40e86039521736575be726992380bf1079e34e9.tar.gz
mkinitcpio-ykfde-b40e86039521736575be726992380bf1079e34e9.tar.zst
less conditions for string duplication
This makes sure second_factor is not NULL and prevents later NULL dereferences. Fixes #23.
Diffstat (limited to 'bin/ykfde.c')
-rw-r--r--bin/ykfde.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/bin/ykfde.c b/bin/ykfde.c
index 2ca7698..eac69c0 100644
--- a/bin/ykfde.c
+++ b/bin/ykfde.c
@@ -283,12 +283,12 @@ int main(int argc, char **argv) {
}
second_factor = payload;
}
-
- /* use an empty string if second_factor is still NULL */
- if (second_factor == NULL)
- second_factor = strdup("");
}
+ /* use an empty string if second_factor is still NULL */
+ if (second_factor == NULL)
+ second_factor = strdup("");
+
/* warn when second factor is not enabled in config */
if (iniparser_getboolean(ini, "general:" CONF2NDFACTOR, 0) == 0 &&
((second_factor != NULL && *second_factor != 0) ||