bpo-34770: Fix a possible null pointer dereference in pyshellext.cpp (GH-9497)
The GlobalLock() call in UpdateDropDescription() was not checked for failure. https://bugs.python.org/issue34770
This commit is contained in:
parent
b60b4683f6
commit
f6c8007a29
|
@ -0,0 +1 @@
|
||||||
|
Fix a possible null pointer dereference in pyshellext.cpp.
|
|
@ -172,6 +172,11 @@ private:
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
}
|
}
|
||||||
auto dd = (DROPDESCRIPTION*)GlobalLock(medium.hGlobal);
|
auto dd = (DROPDESCRIPTION*)GlobalLock(medium.hGlobal);
|
||||||
|
if (!dd) {
|
||||||
|
OutputDebugString(L"PyShellExt::UpdateDropDescription - failed to lock DROPDESCRIPTION hGlobal");
|
||||||
|
ReleaseStgMedium(&medium);
|
||||||
|
return E_FAIL;
|
||||||
|
}
|
||||||
StringCchCopy(dd->szMessage, sizeof(dd->szMessage) / sizeof(dd->szMessage[0]), DRAG_MESSAGE);
|
StringCchCopy(dd->szMessage, sizeof(dd->szMessage) / sizeof(dd->szMessage[0]), DRAG_MESSAGE);
|
||||||
StringCchCopy(dd->szInsert, sizeof(dd->szInsert) / sizeof(dd->szInsert[0]), PathFindFileNameW(target));
|
StringCchCopy(dd->szInsert, sizeof(dd->szInsert) / sizeof(dd->szInsert[0]), PathFindFileNameW(target));
|
||||||
dd->type = DROPIMAGE_MOVE;
|
dd->type = DROPIMAGE_MOVE;
|
||||||
|
|
Loading…
Reference in New Issue