Fix Bug 975056 - [capi] fix check for NULL ptr lack in nss_ckcapi_CreatePrivateKey() a=maksqwe1, r=emaldona,rrelyea
authorElio Maldonado <emaldona@redhat.com>
Wed, 19 Mar 2014 09:33:20 -0700
changeset 11087 a0115aed4a14cf38481b4f1e77cc48667da6f4fd
parent 11086 a906f71ff3831361cde6aff258ff00a85b9b0c09
child 11088 7a11b6c73fd07c0b1acb7d6f0523603be4b5c9b7
push id336
push useremaldona@redhat.com
push dateWed, 19 Mar 2014 16:35:08 +0000
reviewersmaksqwe1, emaldona, rrelyea
bugs975056
Fix Bug 975056 - [capi] fix check for NULL ptr lack in nss_ckcapi_CreatePrivateKey() a=maksqwe1, r=emaldona,rrelyea - Patch contributed by Maks Naumov, maksqwe1@ukr.net - Check for NULL ptr using containerName after ckcapi_getContainer
lib/ckfw/capi/cobject.c
--- a/lib/ckfw/capi/cobject.c
+++ b/lib/ckfw/capi/cobject.c
@@ -2152,17 +2152,17 @@ nss_ckcapi_CreatePrivateKey
   if (CKR_OK != *pError) {
     return (ckcapiInternalObject *)NULL;
   }
   providerName = ckcapi_getDefaultProvider(pError);
   if ((char *)NULL == providerName ) {
     return (ckcapiInternalObject *)NULL;
   }
   containerName = ckcapi_getContainer(pError, &keyID);
-  if ((char *)NULL == providerName ) {
+  if ((char *)NULL == containerName) {
     goto loser;
   }
   rc = CryptAcquireContext(&hProv, containerName, providerName, 
                            PROV_RSA_FULL, CRYPT_NEWKEYSET);
   if (!rc) {
     msError = GetLastError();
     *pError = CKR_DEVICE_ERROR;
     goto loser;