mirror of
https://github.com/gnif/LookingGlass.git
synced 2026-08-22 07:01:30 +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)
|
if (!totalSize)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
size_t effective = strlen(title) + 1;
|
size_t effective = strlen(title);
|
||||||
if (effective > totalSize)
|
if (effective > totalSize)
|
||||||
effective = totalSize;
|
effective = totalSize - 1;
|
||||||
|
|
||||||
memcpy(buffer, title, effective - 1);
|
memcpy(buffer, title, effective);
|
||||||
buffer[effective - 1] = '\0';
|
memset(buffer + effective, 0, totalSize - effective);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user