]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
cryptsetup: Fix null pointer dereference (#16987)
authorMikael Szreder <miszr@users.noreply.github.com>
Wed, 9 Sep 2020 19:26:21 +0000 (21:26 +0200)
committerGitHub <noreply@github.com>
Wed, 9 Sep 2020 19:26:21 +0000 (21:26 +0200)
cryptsetup: Fix null pointer dereference

Fix null pointer dereference in the pkcs11 related code of systemd-cryptsetup

src/shared/pkcs11-util.c

index 632964df4491c81de264cb1112eae0c3676b02f2..4088439f93ff918f3d33d5e52118dab4d37038c0 100644 (file)
@@ -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;
         }