Explicitly null-terminate the output from readlink in discord_register_linux.cpp.
This commit is contained in:
@ -33,9 +33,13 @@ extern "C" DISCORD_EXPORT void Discord_Register(const char* applicationId, const
|
|||||||
|
|
||||||
char exePath[1024];
|
char exePath[1024];
|
||||||
if (!command || !command[0]) {
|
if (!command || !command[0]) {
|
||||||
if (readlink("/proc/self/exe", exePath, sizeof(exePath)) <= 0) {
|
size_t size = readlink("/proc/self/exe", exePath, sizeof(exePath));
|
||||||
|
if (size <= 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (size < sizeof(exePath)) {
|
||||||
|
exePath[size] = '\0';
|
||||||
|
}
|
||||||
command = exePath;
|
command = exePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user