1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-09-28 21:19:10 +00:00

Make sure the $exec buffer is null-terminated

This commit is contained in:
Pavel Labath 2010-01-13 13:34:14 +01:00
parent 86e744d334
commit c62266a5db

View File

@ -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';
}