commit 0bc73a08fc82333fd27730cf721d5c6e2593f68e
parent 9af27fcb9c07d0118dd1986a23a9d04b3c5acc71
Author: Colin Leroy <colin@colino.net>
Date: Thu, 8 Oct 2015 19:03:00 +0200
Fix possibly non-null-terminated string
Diffstat:
1 file changed, 1 insertion(+), 0 deletions(-)
diff --git a/src/plugins/clamd/libclamd/clamd-plugin.c b/src/plugins/clamd/libclamd/clamd-plugin.c
@@ -369,6 +369,7 @@ Clamd_Stat clamd_init(Clamd_Socket* config) {
}
memset(buf, '\0', sizeof(buf));
while ((n_read = read(sock, buf, BUFSIZ)) > 0) {
+ buf[n_read] = '\0';
if (buf[strlen(buf) - 1] == '\n')
buf[strlen(buf) - 1] = '\0';
debug_print("Ping result: %s\n", buf);