From: Mikael Szreder Date: Wed, 9 Sep 2020 19:26:21 +0000 (+0200) Subject: cryptsetup: Fix null pointer dereference (#16987) X-Git-Tag: v247-rc1~271 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=664ad0f6f54257643fa069d9e1e9cad0f6fd7cc3;p=thirdparty%2Fsystemd.git cryptsetup: Fix null pointer dereference (#16987) cryptsetup: Fix null pointer dereference Fix null pointer dereference in the pkcs11 related code of systemd-cryptsetup --- diff --git a/src/shared/pkcs11-util.c b/src/shared/pkcs11-util.c index 632964df449..4088439f93f 100644 --- a/src/shared/pkcs11-util.c +++ b/src/shared/pkcs11-util.c @@ -212,13 +212,15 @@ int pkcs11_token_login( "Failed to log into security token '%s': %s", token_label, p11_kit_strerror(rv)); log_info("Successfully logged into security token '%s' via protected authentication path.", token_label); - *ret_used_pin = NULL; + if (ret_used_pin) + *ret_used_pin = NULL; return 0; } if (!FLAGS_SET(token_info->flags, CKF_LOGIN_REQUIRED)) { log_info("No login into security token '%s' required.", token_label); - *ret_used_pin = NULL; + if (ret_used_pin) + *ret_used_pin = NULL; return 0; }