[MMIXER]
authorJohannes Anderwald <johannes.anderwald@reactos.org>
Sat, 19 Dec 2009 21:44:39 +0000 (21:44 +0000)
committerJohannes Anderwald <johannes.anderwald@reactos.org>
Sat, 19 Dec 2009 21:44:39 +0000 (21:44 +0000)
- Fix buffer overflow

svn path=/trunk/; revision=44660

reactos/lib/drivers/sound/mmixer/controls.c

index a366067..adc8187 100644 (file)
@@ -576,8 +576,12 @@ MMixerCreateDestinationLine(
 
     if (LineName)
     {
-        wcscpy(DestinationLine->Line.szShortName, LineName);
-        wcscpy(DestinationLine->Line.szName, LineName);
+        MixerContext->Copy(DestinationLine->Line.szShortName, LineName, (min(MIXER_SHORT_NAME_CHARS, wcslen(LineName)+1)) * sizeof(WCHAR));
+        DestinationLine->Line.szShortName[MIXER_SHORT_NAME_CHARS-1] = L'\0';
+
+        MixerContext->Copy(DestinationLine->Line.szName, LineName, (min(MIXER_LONG_NAME_CHARS, wcslen(LineName)+1)) * sizeof(WCHAR));
+        DestinationLine->Line.szName[MIXER_LONG_NAME_CHARS-1] = L'\0';
+
     }
     else
     {