From 583818513307d8d750cc0232c5d604ef9905ec55 Mon Sep 17 00:00:00 2001 From: Rob Shearman Date: Mon, 25 Feb 2008 09:00:47 +0000 Subject: [PATCH] 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. --- dlls/mciavi32/info.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/dlls/mciavi32/info.c b/dlls/mciavi32/info.c index 7787fb260c0..0b5752a7548 100644 --- a/dlls/mciavi32/info.c +++ b/dlls/mciavi32/info.c @@ -230,22 +230,22 @@ DWORD MCIAVI_mciSet(UINT wDevID, DWORD dwFlags, LPMCI_DGV_SET_PARMS lpParms) strcpy(buffer, "MCI_SET_ON:"); if (dwFlags & MCI_SET_VIDEO) { - strncat(buffer, " video", sizeof(buffer)); + strncat(buffer, " video", sizeof(buffer)-sizeof("MCI_SET_ON:")); wma->dwSet |= 4; } if (dwFlags & MCI_SET_AUDIO) { - strncat(buffer, " audio", sizeof(buffer)); + strncat(buffer, " audio", sizeof(buffer)-sizeof("MCI_SET_ON:")); switch (lpParms->dwAudio) { case MCI_SET_AUDIO_ALL: - strncat(buffer, " all", sizeof(buffer)); + strncat(buffer, " all", sizeof(buffer)-sizeof("MCI_SET_ON:")); wma->dwSet |= 3; break; case MCI_SET_AUDIO_LEFT: - strncat(buffer, " left", sizeof(buffer)); + strncat(buffer, " left", sizeof(buffer)-sizeof("MCI_SET_ON:")); wma->dwSet |= 1; break; case MCI_SET_AUDIO_RIGHT: - strncat(buffer, " right", sizeof(buffer)); + strncat(buffer, " right", sizeof(buffer)-sizeof("MCI_SET_ON:")); wma->dwSet |= 2; break; default: @@ -264,22 +264,22 @@ DWORD MCIAVI_mciSet(UINT wDevID, DWORD dwFlags, LPMCI_DGV_SET_PARMS lpParms) strcpy(buffer, "MCI_SET_OFF:"); if (dwFlags & MCI_SET_VIDEO) { - strncat(buffer, " video", sizeof(buffer)); + strncat(buffer, " video", sizeof(buffer)-sizeof("MCI_SET_OFF:")); wma->dwSet &= ~4; } if (dwFlags & MCI_SET_AUDIO) { - strncat(buffer, " audio", sizeof(buffer)); + strncat(buffer, " audio", sizeof(buffer)-sizeof("MCI_SET_OFF:")); switch (lpParms->dwAudio) { case MCI_SET_AUDIO_ALL: - strncat(buffer, " all", sizeof(buffer)); + strncat(buffer, " all", sizeof(buffer)-sizeof("MCI_SET_OFF:")); wma->dwSet &= ~3; break; case MCI_SET_AUDIO_LEFT: - strncat(buffer, " left", sizeof(buffer)); + strncat(buffer, " left", sizeof(buffer)-sizeof("MCI_SET_OFF:")); wma->dwSet &= ~2; break; case MCI_SET_AUDIO_RIGHT: - strncat(buffer, " right", sizeof(buffer)); + strncat(buffer, " right", sizeof(buffer)-sizeof("MCI_SET_OFF:")); wma->dwSet &= ~2; break; default: @@ -288,7 +288,7 @@ DWORD MCIAVI_mciSet(UINT wDevID, DWORD dwFlags, LPMCI_DGV_SET_PARMS lpParms) } } 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); }