aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2012-08-30 12:01:14 -0500
committerTed Gould <ted@gould.cx>2012-08-30 12:01:14 -0500
commitd71967fdfecdc1ed309eac4e68b4a72d522d3633 (patch)
treebaa1e7e0bc137f95c86b2039e99fa655ca956300
parentf839484b45f89e62a3e635c35402ebd807e78499 (diff)
downloadlibpam-freerdp2-d71967fdfecdc1ed309eac4e68b4a72d522d3633.tar.gz
libpam-freerdp2-d71967fdfecdc1ed309eac4e68b4a72d522d3633.tar.bz2
libpam-freerdp2-d71967fdfecdc1ed309eac4e68b4a72d522d3633.zip
Make sure to lock the password buffer
-rw-r--r--src/freerdp-auth-check.c14
1 files 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;
}