diff --git a/reactos/dll/shellext/ntobjshex/ntobjenum.cpp b/reactos/dll/shellext/ntobjshex/ntobjenum.cpp index 08958ff10e7..0e4bba0eccd 100644 --- a/reactos/dll/shellext/ntobjshex/ntobjenum.cpp +++ b/reactos/dll/shellext/ntobjshex/ntobjenum.cpp @@ -437,7 +437,10 @@ public: otype = REG_ENTRY_VALUE_WITH_CONTENT; } - RegPidlEntry* entry = (RegPidlEntry*) CoTaskMemAlloc(entryBufferLength + 2); + // allocate space for the terminator + entryBufferLength += 2; + + RegPidlEntry* entry = (RegPidlEntry*) CoTaskMemAlloc(entryBufferLength); if (!entry) return E_OUTOFMEMORY;