Fix Coverity CIDs #1398812, #1398813, #1398814.
authorwwp <wwp@free.fr>
Mon, 16 Jan 2017 17:29:15 +0000 (18:29 +0100)
committerwwp <wwp@free.fr>
Mon, 16 Jan 2017 17:29:15 +0000 (18:29 +0100)
Will convert compose_convert_header needs for fixed buffers later.

src/compose.c
src/messageview.c
src/procheader.c

index 3308f3cbca9ab73307076eb7a6ac4afe4dba29f8..dfd0d2266d79606d59156c6dc3d9795f2308a9e9 100644 (file)
@@ -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",
index 7052ff84891e8b66ef5fbfa02fcb62bb6af87958..4e15e0710360d999ce0028af31c66a7e79e4bcf8 100644 (file)
@@ -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");
        }
index 2aa4e6f66e8f64f292b225cd726fb409be03f2d5..f09cf9cd9b10da53cae3f50c16b2360f26925b6d 100644 (file)
@@ -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);