diff options
author | relyea%netscape.com <devnull@localhost> | 2005-08-01 18:23:55 +0000 |
---|---|---|
committer | relyea%netscape.com <devnull@localhost> | 2005-08-01 18:23:55 +0000 |
commit | d9b21862e6eebbca10670e297432404510b073bf (patch) | |
tree | a0a005e3997d0c7a6df9b0f3504c4118968aeb06 | |
parent | 2d6dce1abf58be42b48d7672cf757079ce2180e0 (diff) | |
download | nss-hg-d9b21862e6eebbca10670e297432404510b073bf.tar.gz |
Bug 298906 crash when accepting new certificate permanently on taschenonkel.de
r=wtc, sr=nelson
-rw-r--r-- | security/nss/lib/softoken/pcertdb.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/security/nss/lib/softoken/pcertdb.c b/security/nss/lib/softoken/pcertdb.c index 98d04d453..ca1452d1a 100644 --- a/security/nss/lib/softoken/pcertdb.c +++ b/security/nss/lib/softoken/pcertdb.c @@ -389,16 +389,24 @@ pkcs11_freeStaticData (unsigned char *data, unsigned char *space) } unsigned char * -pkcs11_copyStaticData(unsigned char *data, int len, - unsigned char *space, int spaceLen) +pkcs11_allocStaticData(int len, unsigned char *space, int spaceLen) { - unsigned char *copy = NULL; + unsigned char *data = NULL; if (len <= spaceLen) { - copy = space; + data = space; } else { - copy = (unsigned char *) PORT_Alloc(len); + data = (unsigned char *) PORT_Alloc(len); } + + return data; +} + +unsigned char * +pkcs11_copyStaticData(unsigned char *data, int len, + unsigned char *space, int spaceLen) +{ + unsigned char *copy = pkcs11_allocStaticData(len, space, spaceLen); if (copy) { PORT_Memcpy(copy,data,len); } |