]> git.saurik.com Git - apple/security.git/blobdiff - OSX/libsecurity_keychain/lib/KCCursor.cpp
Security-58286.260.20.tar.gz
[apple/security.git] / OSX / libsecurity_keychain / lib / KCCursor.cpp
index d6b6e3326219c9c1b2f1d5a7b9fbb3d51811906e..a5d25d961b372af17e217bb9f53dd1cb633c4938 100644 (file)
@@ -37,6 +37,7 @@
 #include <Security/SecKeychainItemPriv.h>
 #include <SecBase.h>
 #include <Security/SecBasePriv.h>
+#include <utilities/array_size.h>
 
 using namespace KeychainCore;
 using namespace CssmClient;
@@ -74,8 +75,9 @@ KCCursorImpl::KCCursorImpl(const StorageManager::KeychainList &searchList, SecIt
        for (const SecKeychainAttribute *attr=attrList->attr; attr != end; ++attr)
        {
                const CSSM_DB_ATTRIBUTE_INFO *temp;
-               
-               if (attr->tag <'    ') // ok, is this a key schema?  Handle differently, just because we can...
+
+               // ok, is this a key schema?  Handle differently, just because we can...
+               if (attr->tag <'    ' && attr->tag < array_size(gKeyAttributeLookupTable))
                {
                        temp = gKeyAttributeLookupTable[attr->tag];
                }
@@ -222,9 +224,6 @@ KCCursorImpl::next(Item &item)
 
             Keychain &kc = *mCurrent;
 
-            // Grab a read lock on the keychain
-            StReadWriteLock __(*(kc->getKeychainReadWriteLock()), StReadWriteLock::Read);
-
             Mutex* mutex = kc->getKeychainMutex();
             StLock<Mutex> _(*mutex);