Fix leaks in softoken's argument string parsin. r=rrelyea,alexei.
Bug 339173. Modified Files: pk11db.c pk11pars.h git-svn-id: svn://10.0.0.236/trunk@214116 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -74,7 +74,7 @@ CK_RV
|
||||
secmod_parseTokenParameters(char *param, sftk_token_parameters *parsed)
|
||||
{
|
||||
int next;
|
||||
char *tmp;
|
||||
char *tmp = NULL;
|
||||
char *index;
|
||||
index = secmod_argStrip(param);
|
||||
|
||||
@@ -85,12 +85,14 @@ secmod_parseTokenParameters(char *param, sftk_token_parameters *parsed)
|
||||
SECMOD_HANDLE_STRING_ARG(index,parsed->tokdes,"tokenDescription=",;)
|
||||
SECMOD_HANDLE_STRING_ARG(index,parsed->slotdes,"slotDescription=",;)
|
||||
SECMOD_HANDLE_STRING_ARG(index,tmp,"minPWLen=",
|
||||
if(tmp) { parsed->minPW=atoi(tmp); PORT_Free(tmp); })
|
||||
if (tmp) { parsed->minPW=atoi(tmp); })
|
||||
SECMOD_HANDLE_STRING_ARG(index,tmp,"flags=",
|
||||
if(tmp) { secmod_parseTokenFlags(param,parsed); PORT_Free(tmp); })
|
||||
if (tmp) { secmod_parseTokenFlags(param,parsed); })
|
||||
SECMOD_HANDLE_FINAL_ARG(index)
|
||||
}
|
||||
return CKR_OK;
|
||||
}
|
||||
if (tmp)
|
||||
PORT_Free(tmp);
|
||||
return CKR_OK;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -143,7 +145,7 @@ CK_RV
|
||||
secmod_parseParameters(char *param, sftk_parameters *parsed, PRBool isFIPS)
|
||||
{
|
||||
int next;
|
||||
char *tmp;
|
||||
char *tmp = NULL;
|
||||
char *index;
|
||||
char *certPrefix = NULL, *keyPrefix = NULL;
|
||||
char *tokdes = NULL, *ptokdes = NULL;
|
||||
@@ -171,11 +173,13 @@ secmod_parseParameters(char *param, sftk_parameters *parsed, PRBool isFIPS)
|
||||
SECMOD_HANDLE_STRING_ARG(index,minPW,"minPWLen=",;)
|
||||
|
||||
SECMOD_HANDLE_STRING_ARG(index,tmp,"flags=",
|
||||
if(tmp) { secmod_parseFlags(param,parsed); PORT_Free(tmp); })
|
||||
if (tmp) { secmod_parseFlags(param,parsed); })
|
||||
SECMOD_HANDLE_STRING_ARG(index,tmp,"tokens=",
|
||||
if(tmp) { secmod_parseTokens(tmp,parsed); PORT_Free(tmp); })
|
||||
if (tmp) { secmod_parseTokens(tmp,parsed); })
|
||||
SECMOD_HANDLE_FINAL_ARG(index)
|
||||
}
|
||||
if (tmp)
|
||||
PORT_Free(tmp);
|
||||
if (parsed->tokens == NULL) {
|
||||
int count = isFIPS ? 1 : 2;
|
||||
int index = count-1;
|
||||
|
||||
@@ -92,6 +92,7 @@ static struct secmodargSlotFlagTable secmod_argSlotFlagTable[] = {
|
||||
#define SECMOD_HANDLE_STRING_ARG(param,target,value,command) \
|
||||
if (PORT_Strncasecmp(param,value,sizeof(value)-1) == 0) { \
|
||||
param += sizeof(value)-1; \
|
||||
if (target) PORT_Free(target); \
|
||||
target = secmod_argFetchValue(param,&next); \
|
||||
param += next; \
|
||||
command ;\
|
||||
|
||||
Reference in New Issue
Block a user