diff --git a/common/src/platform/linux/proctitle.c b/common/src/platform/linux/proctitle.c index b5ad2c69..9aa27869 100644 --- a/common/src/platform/linux/proctitle.c +++ b/common/src/platform/linux/proctitle.c @@ -123,10 +123,10 @@ void lgSetProcessTitle(const char * title) if (!totalSize) return; - size_t effective = strlen(title) + 1; + size_t effective = strlen(title); if (effective > totalSize) - effective = totalSize; + effective = totalSize - 1; - memcpy(buffer, title, effective - 1); - buffer[effective - 1] = '\0'; + memcpy(buffer, title, effective); + memset(buffer + effective, 0, totalSize - effective); }