diff --git a/neo/sys/linux/main.cpp b/neo/sys/linux/main.cpp index 01cb25fb..4c5cd16c 100644 --- a/neo/sys/linux/main.cpp +++ b/neo/sys/linux/main.cpp @@ -109,6 +109,11 @@ bool Sys_GetPath(sysPath_t type, idStr &path) { idStr::snPrintf(buf, sizeof(buf), "/proc/%d/exe", getpid()); len = readlink(buf, buf2, sizeof(buf2)); if (len != -1) { + if (len < MAX_OSPATH) { + buf2[len] = '\0'; + } else { + buf2[MAX_OSPATH - 1] = '\0'; + } path = buf2; return true; }