]> git.saurik.com Git - apple/security.git/blobdiff - OSX/libsecurity_keychain/lib/SecAccess.cpp
Security-58286.260.20.tar.gz
[apple/security.git] / OSX / libsecurity_keychain / lib / SecAccess.cpp
index 4dacfa95bb05a227ba703491dbb5a75ca649b8fe..301cf0e52eea15b3b5f84e800b9b94bfc5ba3241 100644 (file)
@@ -321,8 +321,9 @@ SecAccessRef SecAccessCreateWithOwnerAndACL(uid_t userId, gid_t groupId, SecAcce
        CFRelease(debugStr);
 #endif
 
-       CSSM_ACL_AUTHORIZATION_TAG rights[numAcls];
-       memset(rights, 0, sizeof(rights));
+    CFIndex rightsSize = numAcls > 0 ? numAcls : 1;
+
+       std::vector<CSSM_ACL_AUTHORIZATION_TAG> rights(numAcls);
 
        for (CFIndex iCnt = 0; iCnt < numAcls; iCnt++)
        {
@@ -382,7 +383,7 @@ SecAccessRef SecAccessCreateWithOwnerAndACL(uid_t userId, gid_t groupId, SecAcce
                                { CSSM_LIST_TYPE_UNKNOWN, &subject1, &subject2 },
                                false,  // Delegate
                                // rights for this entry
-                               { (uint32)(sizeof(rights) / sizeof(rights[0])), rights },
+                               { (uint32)numAcls, rights.data() },
                                // rest is defaulted
                        }
                }
@@ -579,9 +580,6 @@ CFArrayRef copyTrustedAppListFromBundle(CFStringRef bundlePath, CFStringRef trus
     if (!trustedAppsURL)
         goto xit;
 
-    if ( trustedAppListFileNameWithoutExtension )
-               CFRelease(trustedAppListFileNameWithoutExtension);
-
        if (!CFURLCreateDataAndPropertiesFromResource(kCFAllocatorDefault,trustedAppsURL,&xmlDataRef,NULL,NULL,&errorCode))
         goto xit;
 
@@ -589,6 +587,7 @@ CFArrayRef copyTrustedAppListFromBundle(CFStringRef bundlePath, CFStringRef trus
     trustedAppList = (CFArrayRef)trustedAppsPlist;
 
 xit:
+    CFReleaseNull(trustedAppListFileNameWithoutExtension);
     if (bundleURL)
         CFRelease(bundleURL);
     if (secBundle)