The return value of readlink is a signed size_t.
This commit is contained in:
parent
7e42120007
commit
01fc42397f
@ -33,13 +33,11 @@ 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]) {
|
||||||
size_t size = readlink("/proc/self/exe", exePath, sizeof(exePath));
|
ssize_t size = readlink("/proc/self/exe", exePath, sizeof(exePath));
|
||||||
if (size <= 0) {
|
if (size <= 0 || size >= sizeof(exePath)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (size < sizeof(exePath)) {
|
exePath[size] = '\0';
|
||||||
exePath[size] = '\0';
|
|
||||||
}
|
|
||||||
command = exePath;
|
command = exePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user