From e02bb24b04e4771ecdfdbe12fe474f886882e66f Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 30 Aug 2012 12:01:14 -0500 Subject: Make sure to lock the password buffer --- src/freerdp-auth-check.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/freerdp-auth-check.c b/src/freerdp-auth-check.c index d50833b..178db98 100644 --- a/src/freerdp-auth-check.c +++ b/src/freerdp-auth-check.c @@ -60,6 +60,10 @@ main (int argc, char * argv[]) return -1; } + if (mlock(password, sizeof(password)) != 0) { + return -1; + } + freerdp_channels_global_init(); freerdp * instance = freerdp_new(); @@ -88,10 +92,14 @@ main (int argc, char * argv[]) instance->settings->port = strtoul(colonloc, NULL, 10); } + int retval = -1; if (freerdp_connect(instance)) { freerdp_disconnect(instance); - return 0; - } else { - return -1; + retval = 0; } + + memset(password, 0, sizeof(password)); + munlock(password, sizeof(password)); + + return retval; } -- cgit v1.2.3