Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
setup: Fix bug with strdup() of NULL pointer.
getenv() can return NULL if the environment variable is not set, but the result of getenv() was always being passed to M_StringDuplicate() without any check. This could cause crashes on some platforms. Instead, rework the code into a first stage that gets the player's name and a second that duplicates it into a mutable form. This fixes #455.
- Loading branch information
66b295d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just giving my cent, what about moving this kind of code in an another function, like M_GetEnvString?