Files
wine-staging/patches/winmm-mciSendCommandA/0001-winmm-Do-not-crash-in-Win-9X-mode-when-an-invalid-de.patch

37 lines
1.3 KiB
Diff
Raw Normal View History

From b15d46b4ddeddaea146f754ac5a618b8721deeee Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Fri, 4 Mar 2016 16:15:50 +0100
Subject: [PATCH] winmm: Do not crash in Win 9X mode when an invalid device ptr
is passed to MCI_OPEN.
---
dlls/winmm/mci.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/dlls/winmm/mci.c b/dlls/winmm/mci.c
index 2048dd65a50..1df3430dc74 100644
--- a/dlls/winmm/mci.c
+++ b/dlls/winmm/mci.c
@@ -247,6 +247,10 @@ static DWORD MCI_MapMsgAtoW(UINT msg, DWORD_PTR dwParam1, DWORD_PTR *dwParam2)
MCI_ANIM_OPEN_PARMSW *mci_openW;
DWORD_PTR *ptr;
+ if ((dwParam1 & (MCI_OPEN_TYPE|MCI_OPEN_TYPE_ID)) == MCI_OPEN_TYPE &&
+ (GetVersion() & 0x80000000) && IsBadStringPtrA(mci_openA->lpstrDeviceType, -1))
+ return MCIERR_MISSING_COMMAND_STRING;
+
ptr = malloc(sizeof(DWORD_PTR) + sizeof(*mci_openW));
if (!ptr) return MCIERR_OUT_OF_MEMORY;
@@ -2288,7 +2292,6 @@ DWORD WINAPI mciSendCommandA(MCIDEVICEID wDevID, UINT wMsg, DWORD_PTR dwParam1,
return ret;
}
ret = mciSendCommandW(wDevID, wMsg, dwParam1, dwParam2);
-
MCI_UnmapMsgAtoW(wMsg, dwParam1, dwParam2, ret);
return ret;
}
--
2.51.0