Bug 1161686 - libmar's |SECU_GetModulePassword| can leak allocated string (command line build utility). Free unused return of GetPasswordString. r=bbondy

This commit is contained in:
Josios 2015-05-12 19:40:06 -07:00
parent a27df7779b
commit b4e7702c38

View File

@ -219,7 +219,11 @@ SECU_GetModulePassword(PK11SlotInfo *slot, PRBool retry, void *arg)
sprintf(prompt,
"Press Enter, then enter PIN for \"%s\" on external device.\n",
PK11_GetTokenName(slot));
(void) GetPasswordString(NULL, prompt);
pw = GetPasswordString(NULL, prompt);
if (pw) {
memset(pw, 0, PORT_Strlen(pw));
PORT_Free(pw);
}
/* Fall Through */
case PW_PLAINTEXT:
return PL_strdup(pwdata->data);