From b40e86039521736575be726992380bf1079e34e9 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Fri, 19 Jan 2018 09:04:35 +0100 Subject: less conditions for string duplication This makes sure second_factor is not NULL and prevents later NULL dereferences. Fixes #23. --- bin/ykfde.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'bin') 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) || -- cgit v1.2.3-54-g00ecf