From b233e6776b6113475676d05cec6f5b8f1318d2f5 Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Wed, 27 Nov 2019 22:15:44 +0100 Subject: [PATCH] Windows: Don't write extra 0x00 byte at the end of DcsProp file when modifying it through UI --- src/Mount/Mount.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Mount/Mount.c b/src/Mount/Mount.c index 7f677580..54dc8158 100644 --- a/src/Mount/Mount.c +++ b/src/Mount/Mount.c @@ -11732,13 +11732,14 @@ static BOOL CALLBACK BootLoaderPreferencesDlgProc (HWND hwndDlg, UINT msg, WPARA while (TextEditDialogBox(FALSE, hwndDlg, GetString ("BOOT_LOADER_CONFIGURATION_FILE"), dcsprop) == IDOK) { - if (0 == strcmp(dcsprop.c_str(), currentDcsprop.c_str())) + const char* dcspropContent = dcsprop.c_str(); + if (0 == strcmp(dcspropContent, currentDcsprop.c_str())) { break; } - else if (validateDcsPropXml (dcsprop.c_str())) + else if (validateDcsPropXml (dcspropContent)) { - WriteESPFile (L"\\EFI\\VeraCrypt\\DcsProp", (LPBYTE) dcsprop.c_str(), (DWORD) dcsprop.size(), true); + WriteESPFile (L"\\EFI\\VeraCrypt\\DcsProp", (LPBYTE) dcspropContent, (DWORD) strlen (dcspropContent), true); break; } else