[common] linux/proctitle: fix off-by-one bug

0884d14bde introduces an off-by-one bug: if
`strlen(title) == totalSize`, then no space will be left for a null terminator.
This commit is contained in:
Quantum
2026-08-16 02:16:36 -04:00
committed by Geoffrey McRae
parent 0884d14bde
commit 4cee75dab5

View File

@@ -124,7 +124,7 @@ void lgSetProcessTitle(const char * title)
return; return;
size_t effective = strlen(title); size_t effective = strlen(title);
if (effective > totalSize) if (effective >= totalSize)
effective = totalSize - 1; effective = totalSize - 1;
memcpy(buffer, title, effective); memcpy(buffer, title, effective);