diff options
author | ian.mcgreer%sun.com <devnull@localhost> | 2001-11-05 16:14:00 +0000 |
---|---|---|
committer | ian.mcgreer%sun.com <devnull@localhost> | 2001-11-05 16:14:00 +0000 |
commit | 644f02c27b985bc8cb752047961a196e790c2f91 (patch) | |
tree | fb8f9a74dbb9f0b0129e543449cdce24a9896ac7 | |
parent | 71ccc9d084f0b10fcd2c99d0a51dfc2fcbcef2a6 (diff) | |
download | nss-hg-644f02c27b985bc8cb752047961a196e790c2f91.tar.gz |
don't return a bad value if there are no found objects
-rw-r--r-- | security/nss/lib/softoken/pkcs11.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/security/nss/lib/softoken/pkcs11.c b/security/nss/lib/softoken/pkcs11.c index 9b02a5e16..7b4300074 100644 --- a/security/nss/lib/softoken/pkcs11.c +++ b/security/nss/lib/softoken/pkcs11.c @@ -3818,8 +3818,12 @@ CK_RV NSC_FindObjects(CK_SESSION_HANDLE hSession, search = session->search; left = session->search->size - session->search->index; transfer = ((int)ulMaxObjectCount > left) ? left : ulMaxObjectCount; - PORT_Memcpy(phObject,&search->handles[search->index], + if (transfer > 0) { + PORT_Memcpy(phObject,&search->handles[search->index], transfer*sizeof(CK_OBJECT_HANDLE_PTR)); + } else { + *phObject = CK_INVALID_HANDLE; + } search->index += transfer; if (search->index == search->size) { session->search = NULL; |