mirror of
https://github.com/gnif/LookingGlass.git
synced 2026-08-21 22:51:31 +00:00
[common] linux/proctitle: zero out entire usable memory block
This avoids additional arguments showing up when their memory hasn't been touched at all.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user