diff options
author | kaie%kuix.de <devnull@localhost> | 2006-04-24 18:04:16 +0000 |
---|---|---|
committer | kaie%kuix.de <devnull@localhost> | 2006-04-24 18:04:16 +0000 |
commit | 725d50e2f166b746c547992028a9452f3283ab57 (patch) | |
tree | 7c877505b8f631ecc7e3b2ea3ca06556b156c607 | |
parent | 362479085ac1fd0923b430f5df9a71580da53b9d (diff) | |
download | nss-hg-725d50e2f166b746c547992028a9452f3283ab57.tar.gz |
bug 334442, Incorrect use of realloc oom Crash in secmod_ReadPermDB
r=nelson, a=dveditz
-rw-r--r-- | security/nss/lib/softoken/pk11db.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/security/nss/lib/softoken/pk11db.c b/security/nss/lib/softoken/pk11db.c index 391803329..69193fd92 100644 --- a/security/nss/lib/softoken/pk11db.c +++ b/security/nss/lib/softoken/pk11db.c @@ -868,7 +868,7 @@ secmod_ReadPermDB(const char *appName, const char *filename, DBT key,data; int ret; DB *pkcs11db = NULL; - char **moduleList = NULL; + char **moduleList = NULL, **newModuleList = NULL; int moduleCount = 1; int useCount = SECMOD_STEP; @@ -888,9 +888,10 @@ secmod_ReadPermDB(const char *appName, const char *filename, PRBool internal = PR_FALSE; if ((moduleCount+1) >= useCount) { useCount += SECMOD_STEP; - moduleList = + newModuleList = (char **)PORT_Realloc(moduleList,useCount*sizeof(char *)); - if (moduleList == NULL) goto done; + if (newModuleList == NULL) goto done; + moduleList = newModuleList; PORT_Memset(&moduleList[moduleCount+1],0, sizeof(char *)*SECMOD_STEP); } |