diff options
author | Mikael Szreder <miszr@users.noreply.github.com> | 2020-09-09 21:26:21 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2020-09-20 11:51:58 +0200 |
commit | cb2468e2d7058fbe3ea2d7ec2bed63efb0df1c1a (patch) | |
tree | 604809a681774a6518b78acb0a087d9e5f4156d3 | |
parent | 7ed17b6fd93ae29e6eb7ab5ca8c799f4c000ca8d (diff) | |
download | systemd-cb2468e2d7058fbe3ea2d7ec2bed63efb0df1c1a.tar.gz |
cryptsetup: Fix null pointer dereference (#16987)
cryptsetup: Fix null pointer dereference
Fix null pointer dereference in the pkcs11 related code of systemd-cryptsetup
(cherry picked from commit 664ad0f6f54257643fa069d9e1e9cad0f6fd7cc3)
(cherry picked from commit f3da0180170deac1a95f8c08c007046227cdbfc7)
-rw-r--r-- | src/shared/pkcs11-util.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/shared/pkcs11-util.c b/src/shared/pkcs11-util.c index 3fcd7630db..4620d2f71e 100644 --- a/src/shared/pkcs11-util.c +++ b/src/shared/pkcs11-util.c @@ -190,14 +190,16 @@ int pkcs11_token_login( return log_error_errno(SYNTHETIC_ERRNO(EIO), "Failed to log into security token '%s': %s", token_label, p11_kit_strerror(rv)); - log_info("Successully logged into security token '%s' via protected authentication path.", token_label); - *ret_used_pin = NULL; + log_info("Successfully logged into security token '%s' via protected authentication path.", token_label); + 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; } |