[gnome-keyring/dbus-api] [gck] Don't crash on OpenSession if flags invalid.



commit 567db59f5266e1985981d920b97366961f2db34a
Author: Stef Walter <stef memberwebs com>
Date:   Sat Aug 22 20:16:07 2009 +0000

    [gck] Don't crash on OpenSession if flags invalid.
    
    If the combination of flags and app_data was invalid when calling
    OpenSession then it would segfault

 pkcs11/gck/gck-module.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
---
diff --git a/pkcs11/gck/gck-module.c b/pkcs11/gck/gck-module.c
index aaa521e..15d9937 100644
--- a/pkcs11/gck/gck-module.c
+++ b/pkcs11/gck/gck-module.c
@@ -1093,6 +1093,8 @@ gck_module_C_OpenSession (GckModule *self, CK_SLOT_ID id, CK_FLAGS flags, CK_VOI
 	 */
 	if (flags & CKF_G_APPLICATION_SESSION) {
 		app = user_data;
+		if (app == NULL)
+			return CKR_ARGUMENTS_BAD;
 		if (app->applicationId)
 			apt = lookup_apartment (self, APARTMENT_ID (id, app->applicationId));
 	} else {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]