mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-18 15:55:36 +00:00
Patch contributed by timeless@bemail.org
[Bug 334442] Incorrect use of realloc oom Crash in secmod_ReadPermDB;r=nelson
This commit is contained in:
parent
c501854878
commit
ff6fa1f51c
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user