FWGS / xash3d

DEPRECATED in favor of https://github.com/FWGS/xash3d-fwgs. Only bugfixes are accepted.
https://xash.su
GNU General Public License v3.0
553 stars 107 forks source link

Fixed a potential buffer overrun when parsing WAD paths #290

Closed noodlecollie closed 7 years ago

noodlecollie commented 7 years ago

The code assumed that the source string would be filled with nulls after the end of the string, which was definitely not the case when building in Debug. This caused stack corruption when starting a new game, as garbage data from the source string was copied blindly into the destination buffer.

The code has been modified so that a WAD path will not be copied in if it would overflow the buffer, and an extra check has been added to terminate the loop if the end of the source string is reached.

In addition, I found another issue while debugging where a pipe handle was being closed twice. This is also fixed here.