Commit 58381851 authored by Rob Shearman's avatar Rob Shearman Committed by Alexandre Julliard

mciavi32: Fix the buffer length passed into strncat in MCIAVI_mciSet.

The number of remaining characters should be passed in, not the total buffer size.
parent 45322bb4
...@@ -230,22 +230,22 @@ DWORD MCIAVI_mciSet(UINT wDevID, DWORD dwFlags, LPMCI_DGV_SET_PARMS lpParms) ...@@ -230,22 +230,22 @@ DWORD MCIAVI_mciSet(UINT wDevID, DWORD dwFlags, LPMCI_DGV_SET_PARMS lpParms)
strcpy(buffer, "MCI_SET_ON:"); strcpy(buffer, "MCI_SET_ON:");
if (dwFlags & MCI_SET_VIDEO) { if (dwFlags & MCI_SET_VIDEO) {
strncat(buffer, " video", sizeof(buffer)); strncat(buffer, " video", sizeof(buffer)-sizeof("MCI_SET_ON:"));
wma->dwSet |= 4; wma->dwSet |= 4;
} }
if (dwFlags & MCI_SET_AUDIO) { if (dwFlags & MCI_SET_AUDIO) {
strncat(buffer, " audio", sizeof(buffer)); strncat(buffer, " audio", sizeof(buffer)-sizeof("MCI_SET_ON:"));
switch (lpParms->dwAudio) { switch (lpParms->dwAudio) {
case MCI_SET_AUDIO_ALL: case MCI_SET_AUDIO_ALL:
strncat(buffer, " all", sizeof(buffer)); strncat(buffer, " all", sizeof(buffer)-sizeof("MCI_SET_ON:"));
wma->dwSet |= 3; wma->dwSet |= 3;
break; break;
case MCI_SET_AUDIO_LEFT: case MCI_SET_AUDIO_LEFT:
strncat(buffer, " left", sizeof(buffer)); strncat(buffer, " left", sizeof(buffer)-sizeof("MCI_SET_ON:"));
wma->dwSet |= 1; wma->dwSet |= 1;
break; break;
case MCI_SET_AUDIO_RIGHT: case MCI_SET_AUDIO_RIGHT:
strncat(buffer, " right", sizeof(buffer)); strncat(buffer, " right", sizeof(buffer)-sizeof("MCI_SET_ON:"));
wma->dwSet |= 2; wma->dwSet |= 2;
break; break;
default: default:
...@@ -264,22 +264,22 @@ DWORD MCIAVI_mciSet(UINT wDevID, DWORD dwFlags, LPMCI_DGV_SET_PARMS lpParms) ...@@ -264,22 +264,22 @@ DWORD MCIAVI_mciSet(UINT wDevID, DWORD dwFlags, LPMCI_DGV_SET_PARMS lpParms)
strcpy(buffer, "MCI_SET_OFF:"); strcpy(buffer, "MCI_SET_OFF:");
if (dwFlags & MCI_SET_VIDEO) { if (dwFlags & MCI_SET_VIDEO) {
strncat(buffer, " video", sizeof(buffer)); strncat(buffer, " video", sizeof(buffer)-sizeof("MCI_SET_OFF:"));
wma->dwSet &= ~4; wma->dwSet &= ~4;
} }
if (dwFlags & MCI_SET_AUDIO) { if (dwFlags & MCI_SET_AUDIO) {
strncat(buffer, " audio", sizeof(buffer)); strncat(buffer, " audio", sizeof(buffer)-sizeof("MCI_SET_OFF:"));
switch (lpParms->dwAudio) { switch (lpParms->dwAudio) {
case MCI_SET_AUDIO_ALL: case MCI_SET_AUDIO_ALL:
strncat(buffer, " all", sizeof(buffer)); strncat(buffer, " all", sizeof(buffer)-sizeof("MCI_SET_OFF:"));
wma->dwSet &= ~3; wma->dwSet &= ~3;
break; break;
case MCI_SET_AUDIO_LEFT: case MCI_SET_AUDIO_LEFT:
strncat(buffer, " left", sizeof(buffer)); strncat(buffer, " left", sizeof(buffer)-sizeof("MCI_SET_OFF:"));
wma->dwSet &= ~2; wma->dwSet &= ~2;
break; break;
case MCI_SET_AUDIO_RIGHT: case MCI_SET_AUDIO_RIGHT:
strncat(buffer, " right", sizeof(buffer)); strncat(buffer, " right", sizeof(buffer)-sizeof("MCI_SET_OFF:"));
wma->dwSet &= ~2; wma->dwSet &= ~2;
break; break;
default: default:
...@@ -288,7 +288,7 @@ DWORD MCIAVI_mciSet(UINT wDevID, DWORD dwFlags, LPMCI_DGV_SET_PARMS lpParms) ...@@ -288,7 +288,7 @@ DWORD MCIAVI_mciSet(UINT wDevID, DWORD dwFlags, LPMCI_DGV_SET_PARMS lpParms)
} }
} }
if (dwFlags & MCI_DGV_SET_SEEK_EXACTLY) { if (dwFlags & MCI_DGV_SET_SEEK_EXACTLY) {
strncat(buffer, " seek_exactly", sizeof(buffer)); strncat(buffer, " seek_exactly", sizeof(buffer)-strlen(buffer)-1);
} }
FIXME("%s\n", buffer); FIXME("%s\n", buffer);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment