Fix possibly non-null-terminated string
authorColin Leroy <colin@colino.net>
Thu, 8 Oct 2015 17:03:00 +0000 (19:03 +0200)
committerColin Leroy <colin@colino.net>
Thu, 8 Oct 2015 17:03:00 +0000 (19:03 +0200)
src/plugins/clamd/libclamd/clamd-plugin.c

index d4a3c94..b50fb90 100644 (file)
@@ -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);