talons

Fork of Claws Mail https://www.claws-mail
Log | Files | Refs | README | LICENSE

commit 47d362fb39527b0f100cdc8c247a472767b6554e
parent 0bc73a08fc82333fd27730cf721d5c6e2593f68e
Author: Colin Leroy <colin@colino.net>
Date:   Thu,  8 Oct 2015 19:08:23 +0200

Fix possibly not null-terminated string

Diffstat:
Msrc/plugins/clamd/libclamd/clamd-plugin.c | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/plugins/clamd/libclamd/clamd-plugin.c b/src/plugins/clamd/libclamd/clamd-plugin.c @@ -389,7 +389,7 @@ Clamd_Stat clamd_init(Clamd_Socket* config) { } memset(buf, '\0', sizeof(buf)); while ((n_read = read(sock, buf, sizeof(buf))) > 0) { - buf[sizeof(buf) - 1] = '\0'; + buf[n_read] = '\0'; if (buf[strlen(buf) - 1] == '\n') buf[strlen(buf) - 1] = '\0'; debug_print("Version: %s\n", buf); @@ -526,7 +526,7 @@ Clamd_Stat clamd_verify_email(const gchar* path, response* result) { g_free(command); memset(buf, '\0', sizeof(buf)); while ((n_read = read(sock, buf, BUFSIZ)) > 0) { - buf[sizeof(buf) - 1] = '\0'; + buf[n_read] = '\0'; if (buf[strlen(buf) - 1] == '\n') buf[strlen(buf) - 1] = '\0'; }