Skip to content

Commit 0394afc

Browse files
committed
To avoid memory corruption through string manipulation.
1 parent 87b3d00 commit 0394afc

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

Externals/openal/OpenAL-Windows/Router/alc.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ ALvoid CleanDeviceSpecifierList()
570570
// create new list
571571
while (strlen(list) > 0)
572572
{
573-
strcpy_s (newListPtr, MAX_PATH, list);
573+
strcpy_s (newListPtr, MAX_PATH - (newListPtr - newList), list);
574574
advancePtr = TRUE;
575575
if (strstr(newListPtr, T2A("DirectSound3D")) != NULL)
576576
{

src/xrEngine/line_edit_control.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,7 @@ void remove_spaces(pstr str)
765765
while (b < str_size && str[b] != ' ')
766766
++b;
767767

768-
strncpy_s(new_str + i, str_size + 1, str + a, b - a);
768+
strncpy_s(new_str + i, str_size - i + 1, str + a, b - a);
769769
i += (b - a);
770770

771771
if (i < str_size)

0 commit comments

Comments
 (0)