summaryrefslogtreecommitdiffstats
path: root/src/windows/leash/LeashView.cpp
diff options
context:
space:
mode:
authorKevin Wasserman <kevin.wasserman@painless-security.com>2012-06-21 15:30:24 -0400
committerBen Kaduk <kaduk@mit.edu>2012-08-24 15:54:51 -0400
commite2ad5d74adbf3edc8a7026cad8283c0077377e81 (patch)
treefd7ddcd010369f6612bd418e8d6fa27d8eec73e0 /src/windows/leash/LeashView.cpp
parentb89802f0a491c6e8c6a320bc1af2b2bbbdb92669 (diff)
downloadkrb5-e2ad5d74adbf3edc8a7026cad8283c0077377e81.tar.gz
krb5-e2ad5d74adbf3edc8a7026cad8283c0077377e81.tar.xz
krb5-e2ad5d74adbf3edc8a7026cad8283c0077377e81.zip
Use file mapping to marshall message data
GlobalAlloc() is no longer supported for this purpose. Also split out leash message marshalling code into a separate function acquire_tkt_send_message_leash and improve string copy safety. Signed-off-by: Kevin Wasserman <kevin.wasserman@painless-security.com> ticket: 7276 (new) queue: kfw target_version: 1.10.4 tags: pullup
Diffstat (limited to 'src/windows/leash/LeashView.cpp')
-rw-r--r--src/windows/leash/LeashView.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/windows/leash/LeashView.cpp b/src/windows/leash/LeashView.cpp
index 96c5127eb9..0460f2c8a1 100644
--- a/src/windows/leash/LeashView.cpp
+++ b/src/windows/leash/LeashView.cpp
@@ -2729,7 +2729,7 @@ LRESULT
CLeashView::OnObtainTGTWithParam(WPARAM wParam, LPARAM lParam)
{
LRESULT res = 0;
- char * param = (char *) GlobalLock((HGLOBAL) lParam);
+ char *param = 0;
LSH_DLGINFO_EX ldi;
ldi.size = sizeof(ldi);
ldi.dlgtype = DLGTYPE_PASSWD;
@@ -2737,6 +2737,14 @@ CLeashView::OnObtainTGTWithParam(WPARAM wParam, LPARAM lParam)
ldi.title = ldi.in.title;
ldi.username = ldi.in.username;
ldi.realm = ldi.in.realm;
+
+ if (lParam)
+ param = (char *) MapViewOfFile((HANDLE)lParam,
+ FILE_MAP_ALL_ACCESS,
+ 0,
+ 0,
+ 4096);
+
if ( param ) {
if ( *param )
strcpy(ldi.in.title,param);
@@ -2757,7 +2765,10 @@ CLeashView::OnObtainTGTWithParam(WPARAM wParam, LPARAM lParam)
ldi.dlgtype |= DLGFLAG_READONLYPRINC;
res = pLeash_kinit_dlg_ex(m_hWnd, &ldi);
- GlobalUnlock((HGLOBAL) lParam);
+ if (param)
+ UnmapViewOfFile(param);
+ if (lParam)
+ CloseHandle((HANDLE )lParam);
::SendMessage(m_hWnd, WM_COMMAND, ID_UPDATE_DISPLAY, 0);
return res;
}