pkcs11: Do not crash with invalid paths in ssh-agent (#1868996)

This commit is contained in:
Jakub Jelen 2020-08-17 09:37:02 +02:00
parent 77aa771110
commit 4c85eb3d53

View File

@ -1216,7 +1216,7 @@ new file mode 100644
index 00000000..e1a7b4e0 index 00000000..e1a7b4e0
--- /dev/null --- /dev/null
+++ b/ssh-pkcs11-uri.c +++ b/ssh-pkcs11-uri.c
@@ -0,0 +1,421 @@ @@ -0,0 +1,425 @@
+/* +/*
+ * Copyright (c) 2017 Red Hat + * Copyright (c) 2017 Red Hat
+ * + *
@ -1468,6 +1468,10 @@ index 00000000..e1a7b4e0
+void +void
+pkcs11_uri_cleanup(struct pkcs11_uri *pkcs11) +pkcs11_uri_cleanup(struct pkcs11_uri *pkcs11)
+{ +{
+ if (pkcs11 == NULL) {
+ return;
+ }
+
+ free(pkcs11->id); + free(pkcs11->id);
+ free(pkcs11->module_path); + free(pkcs11->module_path);
+ free(pkcs11->token); + free(pkcs11->token);