Skip to content

Commit

Permalink
To avoid memory corruption through string manipulation.
Browse files Browse the repository at this point in the history
  • Loading branch information
intorr committed Dec 8, 2017
1 parent 87b3d00 commit 0394afc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Externals/openal/OpenAL-Windows/Router/alc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ ALvoid CleanDeviceSpecifierList()
// create new list
while (strlen(list) > 0)
{
strcpy_s (newListPtr, MAX_PATH, list);
strcpy_s (newListPtr, MAX_PATH - (newListPtr - newList), list);
advancePtr = TRUE;
if (strstr(newListPtr, T2A("DirectSound3D")) != NULL)
{
Expand Down
2 changes: 1 addition & 1 deletion src/xrEngine/line_edit_control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,7 @@ void remove_spaces(pstr str)
while (b < str_size && str[b] != ' ')
++b;

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

if (i < str_size)
Expand Down

0 comments on commit 0394afc

Please sign in to comment.