Skip to content

Fix segfault when setting forceskin to None

Hanicef requested to merge Hanicef/SRB2:fix-forceskin-none-segfault into next

In a multiplayer game, setting forceskin to None from the settings menu triggered a segfault. This happened because of a special handling of the forceskin variable, where it converts an integer to a string since forceskin does not accept an integer. Problem is that when it's set to None, it's numeric value is -1, which doesn't map to a valid skin and is thus set to NULL. This will then be dereferenced inside the memcpy call and trigger the segfault.

This patch cleans up all logic there and avoids setting the value when it's NULL, which resets the value to it's default value, None.

Merge request reports

Loading