using secure memory where applicable using sodium_malloc or sodium_mlock, where not

This commit is contained in:
TLINDEN
2015-01-13 13:07:32 +01:00
parent ecf243b7ae
commit 3c30d8871b
14 changed files with 92 additions and 50 deletions

View File

@@ -107,10 +107,15 @@ retry:
fclose(readfrom);
/* Copy the password out. */
char *p = smalloc(strlen(passbuf) + 1);
memcpy(p, passbuf, strlen(passbuf) + 1 );
*passwd = p;
/*
if ((*passwd = strdup(passbuf)) == NULL) {
fatal(ptx, "Cannot allocate memory\n");
goto err1;
}
*/
/* Zero any stored passwords. */
memset(passbuf, 0, MAXPASSLEN);