mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-12-26 12:27:52 +00:00
Make sure the $exec buffer is null-terminated
This commit is contained in:
parent
86e744d334
commit
c62266a5db
@ -162,7 +162,7 @@ static inline void read_exec(const char *data, char *buf, const int size)
|
||||
|
||||
length = fread(buf, 1, size, fp);
|
||||
pclose(fp);
|
||||
buf[length] = '\0';
|
||||
buf[std::min(length, size-1)] = '\0';
|
||||
if (length > 0 && buf[length - 1] == '\n') {
|
||||
buf[length - 1] = '\0';
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user