baldurk / renderdoc

RenderDoc is a stand-alone graphics debugging tool.
https://renderdoc.org
MIT License
8.6k stars 1.3k forks source link

Provide fallbacks within POSIX GetHomeFolderFilename() #3365

Closed cmannett85-arm closed 1 week ago

cmannett85-arm commented 1 week ago

There are scenarios (specifically when running in anonymous containers) where there is no entry in the password file for the current user, this causes getpwuid() to return a NULL pointer promptly causing a segfault.

This change detects this and then attempts to read the $HOME env var, and if that fails it falls back to the temp dir. Although the temp dir is not valid as a home dir, it is a valid path and so can be used by the calling function.