diff options
author | Sean Hall <r.sean.hall@gmail.com> | 2022-05-26 17:32:45 -0500 |
---|---|---|
committer | Sean Hall <r.sean.hall@gmail.com> | 2022-05-31 13:20:44 -0500 |
commit | 0f9931107ecf9e1f6714e6fd2cabc76d2ddb1153 (patch) | |
tree | 0b20cc3b0fd9f21616d09420fa0c1a90c20a70a0 /src/libs/dutil/WixToolset.DUtil/thmutil.cpp | |
parent | 6f062d1e816ff8d3127ddcbdc7ee0335873bbab8 (diff) | |
download | wix-0f9931107ecf9e1f6714e6fd2cabc76d2ddb1153.tar.gz wix-0f9931107ecf9e1f6714e6fd2cabc76d2ddb1153.tar.bz2 wix-0f9931107ecf9e1f6714e6fd2cabc76d2ddb1153.zip |
Add MemSizeChecked.
Diffstat (limited to 'src/libs/dutil/WixToolset.DUtil/thmutil.cpp')
-rw-r--r-- | src/libs/dutil/WixToolset.DUtil/thmutil.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/libs/dutil/WixToolset.DUtil/thmutil.cpp b/src/libs/dutil/WixToolset.DUtil/thmutil.cpp index d3d32176..52a52a1e 100644 --- a/src/libs/dutil/WixToolset.DUtil/thmutil.cpp +++ b/src/libs/dutil/WixToolset.DUtil/thmutil.cpp | |||
@@ -1189,6 +1189,7 @@ DAPI_(HRESULT) ThemeShowPageEx( | |||
1189 | BOOL fSaveEditboxes = FALSE; | 1189 | BOOL fSaveEditboxes = FALSE; |
1190 | THEME_SAVEDVARIABLE* pSavedVariable = NULL; | 1190 | THEME_SAVEDVARIABLE* pSavedVariable = NULL; |
1191 | THEME_PAGE* pPage = ThemeGetPage(pTheme, dwPage); | 1191 | THEME_PAGE* pPage = ThemeGetPage(pTheme, dwPage); |
1192 | SIZE_T cb = 0; | ||
1192 | 1193 | ||
1193 | if (pPage) | 1194 | if (pPage) |
1194 | { | 1195 | { |
@@ -1219,9 +1220,9 @@ DAPI_(HRESULT) ThemeShowPageEx( | |||
1219 | if (THEME_SHOW_PAGE_REASON_REFRESH != reason) | 1220 | if (THEME_SHOW_PAGE_REASON_REFRESH != reason) |
1220 | { | 1221 | { |
1221 | pPage->cSavedVariables = 0; | 1222 | pPage->cSavedVariables = 0; |
1222 | if (pPage->rgSavedVariables) | 1223 | if (pPage->rgSavedVariables && SUCCEEDED(MemSizeChecked(pPage->rgSavedVariables, &cb))) |
1223 | { | 1224 | { |
1224 | SecureZeroMemory(pPage->rgSavedVariables, MemSize(pPage->rgSavedVariables)); | 1225 | SecureZeroMemory(pPage->rgSavedVariables, cb); |
1225 | } | 1226 | } |
1226 | } | 1227 | } |
1227 | 1228 | ||
@@ -1238,7 +1239,11 @@ DAPI_(HRESULT) ThemeShowPageEx( | |||
1238 | hr = MemEnsureArraySize(reinterpret_cast<LPVOID*>(&pPage->rgSavedVariables), pPage->cControlIndices, sizeof(THEME_SAVEDVARIABLE), pPage->cControlIndices); | 1239 | hr = MemEnsureArraySize(reinterpret_cast<LPVOID*>(&pPage->rgSavedVariables), pPage->cControlIndices, sizeof(THEME_SAVEDVARIABLE), pPage->cControlIndices); |
1239 | ThmExitOnFailure(hr, "Failed to allocate memory for saved variables."); | 1240 | ThmExitOnFailure(hr, "Failed to allocate memory for saved variables."); |
1240 | 1241 | ||
1241 | SecureZeroMemory(pPage->rgSavedVariables, MemSize(pPage->rgSavedVariables)); | 1242 | if (SUCCEEDED(MemSizeChecked(pPage->rgSavedVariables, &cb))) |
1243 | { | ||
1244 | SecureZeroMemory(pPage->rgSavedVariables, cb); | ||
1245 | } | ||
1246 | |||
1242 | pPage->cSavedVariables = pPage->cControlIndices; | 1247 | pPage->cSavedVariables = pPage->cControlIndices; |
1243 | 1248 | ||
1244 | // Save the variables in the loop below. | 1249 | // Save the variables in the loop below. |