diff options
author | Rich Megginson <rmeggins@redhat.com> | 2009-12-18 08:23:08 -0700 |
---|---|---|
committer | Rob Crittenden <rcritten@redhat.com> | 2010-04-12 16:50:59 -0400 |
commit | a2f68c345a45554aeabae0382f90444e00552300 (patch) | |
tree | c2fe57c9b821ec9d827b744e2549654bfd3716db /psession.c | |
parent | 36c0348e68e7aa8126b1e1f78c83de0979973c1b (diff) | |
download | pemnss-a2f68c345a45554aeabae0382f90444e00552300.tar.gz pemnss-a2f68c345a45554aeabae0382f90444e00552300.tar.xz pemnss-a2f68c345a45554aeabae0382f90444e00552300.zip |
Make CopyObject return a new, shallow copy
Due to the semantics or possibly a bug in NSSCKFWC_CopyObject(), the
pem CopyObject function must return a new mdObject *. So this patch
creates a new mdObject as a shallow copy of the old one.
Diffstat (limited to 'psession.c')
-rw-r--r-- | psession.c | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -178,8 +178,16 @@ pem_mdSession_CopyObject CK_RV * pError ) { + NSSCKMDObject *rvmdObject = NULL; pemInternalObject *io = (pemInternalObject *) mdOldObject->etc; + /* make a new mdObject */ + rvmdObject = nss_ZNEW(arena, NSSCKMDObject); + if ((NSSCKMDObject *) NULL == rvmdObject) { + *pError = CKR_HOST_MEMORY; + return (NSSCKMDObject *) NULL; + } + if (NULL == io->list) { io->refCount ++; } else { @@ -190,7 +198,10 @@ pem_mdSession_CopyObject item = item->next; } } - return mdOldObject; + /* struct (shallow) copy the old one */ + *rvmdObject = *mdOldObject; + + return rvmdObject; } CK_RV |