talons

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

commit 033bbdd7cd3e81e56054a514ef50ca473e89bbf0
parent 989b3a3f51c691b0bb0fd48521063a8c76d269ce
Author: wwp <wwp@free.fr>
Date:   Mon, 16 Jan 2017 18:29:15 +0100

Fix Coverity CIDs #1398812, #1398813, #1398814.
Will convert compose_convert_header needs for fixed buffers later.

Diffstat:
Msrc/compose.c | 6++++--
Msrc/messageview.c | 2+-
Msrc/procheader.c | 8+-------
3 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/src/compose.c b/src/compose.c @@ -5564,13 +5564,15 @@ static gint compose_redirect_write_to_file(Compose *compose, FILE *fdest) err |= (fputs(" (by way of ", fdest) == EOF); if (compose->account->name && *compose->account->name) { + gchar buffer[BUFFSIZE]; + compose_convert_header - (compose, buf, sizeof(buf), + (compose, buffer, sizeof(buffer), compose->account->name, strlen("From: "), FALSE); err |= (fprintf(fdest, "%s <%s>", - buf, + buffer, compose->account->address) < 0); } else err |= (fprintf(fdest, "%s", diff --git a/src/messageview.c b/src/messageview.c @@ -794,7 +794,7 @@ static void notification_convert_header(gchar **dest, } else { *dest = g_malloc(BUFFSIZE); if (*dest) - conv_encode_header(*dest, sizeof(dest), src, header_len, FALSE); + conv_encode_header(*dest, BUFFSIZE, src, header_len, FALSE); else debug_print("notification_convert_header: alloc"); } diff --git a/src/procheader.c b/src/procheader.c @@ -1155,13 +1155,7 @@ gint procheader_get_header_from_msginfo(MsgInfo *msginfo, gchar **buf, gchar *he return -1; } val = procheader_get_one_field(buf, fp, hentry); - if (buf == NULL) { - claws_unlink(file); - g_free(file); - g_free(*buf); - *buf = NULL; - return -1; - } + if (fclose(fp) == EOF) { FILE_OP_ERROR(file, "fclose"); claws_unlink(file);