diff options
Diffstat (limited to 'src/dutil/metautil.cpp')
| -rw-r--r-- | src/dutil/metautil.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/dutil/metautil.cpp b/src/dutil/metautil.cpp index 109cd31e..f313fc1c 100644 --- a/src/dutil/metautil.cpp +++ b/src/dutil/metautil.cpp | |||
| @@ -299,7 +299,14 @@ extern "C" HRESULT DAPI MetaGetValue( | |||
| 299 | MetaExitOnNull(pmr->pbMDData, hr, E_OUTOFMEMORY, "failed to allocate memory for metabase value"); | 299 | MetaExitOnNull(pmr->pbMDData, hr, E_OUTOFMEMORY, "failed to allocate memory for metabase value"); |
| 300 | } | 300 | } |
| 301 | else // set the size of the data to the actual size of the memory | 301 | else // set the size of the data to the actual size of the memory |
| 302 | pmr->dwMDDataLen = (DWORD)MemSize(pmr->pbMDData); | 302 | { |
| 303 | SIZE_T cb = MemSize(pmr->pbMDData); | ||
| 304 | if (cb > DWORD_MAX) | ||
| 305 | { | ||
| 306 | MetaExitOnRootFailure(hr = E_INVALIDSTATE, "metabase data is too large: %Iu", cb); | ||
| 307 | } | ||
| 308 | pmr->dwMDDataLen = (DWORD)cb; | ||
| 309 | } | ||
| 303 | 310 | ||
| 304 | hr = piMetabase->GetData(mhKey, wzKey, pmr, &cbRequired); | 311 | hr = piMetabase->GetData(mhKey, wzKey, pmr, &cbRequired); |
| 305 | if (HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER) == hr) | 312 | if (HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER) == hr) |
