Marcus Meissner : dmloader: Fixed some pointer read/write checks (Coverity) .
Alexandre Julliard
julliard at winehq.org
Mon Feb 2 09:01:20 CST 2009
Module: wine
Branch: master
Commit: 2aebb568a8ffb749b0249907f8b26c8fa83734d2
URL: http://source.winehq.org/git/wine.git/?a=commit;h=2aebb568a8ffb749b0249907f8b26c8fa83734d2
Author: Marcus Meissner <marcus at jet.franken.de>
Date: Sat Jan 31 23:36:44 2009 +0100
dmloader: Fixed some pointer read/write checks (Coverity).
---
dlls/dmloader/container.c | 28 +++++++---------------------
1 files changed, 7 insertions(+), 21 deletions(-)
diff --git a/dlls/dmloader/container.c b/dlls/dmloader/container.c
index 081fcce..3cd166e 100644
--- a/dlls/dmloader/container.c
+++ b/dlls/dmloader/container.c
@@ -125,29 +125,15 @@ static HRESULT WINAPI IDirectMusicContainerImpl_IDirectMusicContainer_EnumObject
TRACE("(%p, %s, %d, %p, %p)\n", This, debugstr_dmguid(rguidClass), dwIndex, pDesc, pwszAlias);
- /* check if we can write to whole pDesc */
- if (pDesc) {
- if (IsBadReadPtr (pDesc, sizeof(DWORD))) {
- ERR(": pDesc->dwSize bad read pointer\n");
- return E_POINTER;
- }
- if (pDesc->dwSize != sizeof(DMUS_OBJECTDESC)) {
- ERR(": invalid pDesc->dwSize\n");
- return E_INVALIDARG;
- }
- if (IsBadWritePtr (pDesc, sizeof(DMUS_OBJECTDESC))) {
- ERR(": pDesc bad write pointer\n");
- return E_POINTER;
- }
- }
- /* check if wszAlias is big enough */
- if (pwszAlias && IsBadWritePtr (pwszAlias, DMUS_MAX_FILENAME_SIZE)) {
- ERR(": wszAlias bad write pointer\n");
- return E_POINTER;
+ if (!pDesc)
+ return E_POINTER;
+ if (pDesc->dwSize != sizeof(DMUS_OBJECTDESC)) {
+ ERR(": invalid pDesc->dwSize %d\n", pDesc->dwSize);
+ return E_INVALIDARG;
}
-
+
DM_STRUCT_INIT(pDesc);
-
+
LIST_FOR_EACH (pEntry, This->pContainedObjects) {
pContainedObject = LIST_ENTRY (pEntry, WINE_CONTAINER_ENTRY, entry);
More information about the wine-cvs
mailing list