ClamAV plugin: manage read errors (fixes CID #1220483).
authorwwp <wwp@free.fr>
Fri, 13 Apr 2018 10:32:47 +0000 (12:32 +0200)
committerwwp <wwp@free.fr>
Fri, 13 Apr 2018 10:32:47 +0000 (12:32 +0200)
src/plugins/clamd/libclamd/clamd-plugin.c

index 963cbca163712c6515b728fa3bfe627ddd387c39..15122bb53c714afc68e68348325e0f16b70bfd56 100644 (file)
@@ -556,6 +556,12 @@ Clamd_Stat clamd_verify_email(const gchar* path, response* result) {
                if (n_read == 0) {
                        buf[n_read] = '\0';
                        debug_print("response: %s\n", buf);
+               } else {
+                       /* in case read() fails */
+                       debug_print("read error %d\n", errno);
+                       result->msg = NULL;
+                       close(sock);
+                       return NO_CONNECTION;
                }
        }
        if (strstr(buf, "ERROR")) {