Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / 81 / b0d3cdcaea6c7661c77880c780457049e28b5a
1 Return-Path: <jani@nikula.org>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id B4B8D42116D\r
6         for <notmuch@notmuchmail.org>; Thu,  5 Jan 2012 12:25:27 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References"\r
9 X-Spam-Flag: NO\r
10 X-Spam-Score: -0.7\r
11 X-Spam-Level: \r
12 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
13         tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
14 Received: from olra.theworths.org ([127.0.0.1])\r
15         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
16         with ESMTP id KCJYxzUhEbSl for <notmuch@notmuchmail.org>;\r
17         Thu,  5 Jan 2012 12:25:26 -0800 (PST)\r
18 Received: from mail-ee0-f53.google.com (mail-ee0-f53.google.com\r
19  [74.125.83.53])        (using TLSv1 with cipher RC4-SHA (128/128 bits))        (No client\r
20  certificate requested) by olra.theworths.org (Postfix) with ESMTPS id\r
21  0F7B8429E31    for <notmuch@notmuchmail.org>; Thu,  5 Jan 2012 12:25:23 -0800\r
22  (PST)\r
23 Received: by mail-ee0-f53.google.com with SMTP id d41so756745eek.26\r
24         for <notmuch@notmuchmail.org>; Thu, 05 Jan 2012 12:25:23 -0800 (PST)\r
25 Received: by 10.213.105.75 with SMTP id s11mr715924ebo.8.1325795123220;\r
26         Thu, 05 Jan 2012 12:25:23 -0800 (PST)\r
27 Received: from localhost (dsl-hkibrasgw4-fe5cdc00-23.dhcp.inet.fi.\r
28         [80.220.92.23])\r
29         by mx.google.com with ESMTPS id q67sm176207998eea.8.2012.01.05.12.25.21\r
30         (version=SSLv3 cipher=OTHER); Thu, 05 Jan 2012 12:25:22 -0800 (PST)\r
31 From: Jani Nikula <jani@nikula.org>\r
32 To: notmuch@notmuchmail.org,\r
33         david@tethera.net\r
34 Subject: [PATCH 1/4] cli: fix use of uninitialized variable in "notmuch reply"\r
35 Date: Thu,  5 Jan 2012 22:25:12 +0200\r
36 Message-Id:\r
37  <974a2ef1f1df7d93e0b5bd642ca8a49f8b727a86.1325794371.git.jani@nikula.org>\r
38 X-Mailer: git-send-email 1.7.5.4\r
39 In-Reply-To: <cover.1325794371.git.jani@nikula.org>\r
40 References: <cover.1325794371.git.jani@nikula.org>\r
41 In-Reply-To: <cover.1325794371.git.jani@nikula.org>\r
42 References: <cover.1325794371.git.jani@nikula.org>\r
43 X-BeenThere: notmuch@notmuchmail.org\r
44 X-Mailman-Version: 2.1.13\r
45 Precedence: list\r
46 List-Id: "Use and development of the notmuch mail system."\r
47         <notmuch.notmuchmail.org>\r
48 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
49         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
50 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
51 List-Post: <mailto:notmuch@notmuchmail.org>\r
52 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
53 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
54         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
55 X-List-Received-Date: Thu, 05 Jan 2012 20:25:28 -0000\r
56 \r
57 notmuch_show_params_t params is only initialized partially in\r
58 notmuch_reply_command(). The only field that is used uninitialized is\r
59 params.decrypt. It is usually non-zero, making "notmuch reply" on encrypted\r
60 messages work by coincidence.\r
61 \r
62 Initialize params properly, and set params.decrypt as needed.\r
63 \r
64 Signed-off-by: Jani Nikula <jani@nikula.org>\r
65 ---\r
66  notmuch-reply.c |   10 +++++-----\r
67  1 files changed, 5 insertions(+), 5 deletions(-)\r
68 \r
69 diff --git a/notmuch-reply.c b/notmuch-reply.c\r
70 index f8d5f64..1f33a86 100644\r
71 --- a/notmuch-reply.c\r
72 +++ b/notmuch-reply.c\r
73 @@ -621,11 +621,9 @@ notmuch_reply_command (void *ctx, int argc, char *argv[])\r
74      char *opt, *query_string;\r
75      int i, ret = 0;\r
76      int (*reply_format_func)(void *ctx, notmuch_config_t *config, notmuch_query_t *query, notmuch_show_params_t *params);\r
77 -    notmuch_show_params_t params;\r
78 +    notmuch_show_params_t params = { .part = -1 };\r
79  \r
80      reply_format_func = notmuch_reply_format_default;\r
81 -    params.part = -1;\r
82 -    params.cryptoctx = NULL;\r
83  \r
84      argc--; argv++; /* skip subcommand argument */\r
85  \r
86 @@ -647,10 +645,12 @@ notmuch_reply_command (void *ctx, int argc, char *argv[])\r
87         } else if ((STRNCMP_LITERAL (argv[i], "--decrypt") == 0)) {\r
88             if (params.cryptoctx == NULL) {\r
89                 GMimeSession* session = g_object_new(g_mime_session_get_type(), NULL);\r
90 -               if (NULL == (params.cryptoctx = g_mime_gpg_context_new(session, "gpg")))\r
91 +               if (NULL == (params.cryptoctx = g_mime_gpg_context_new(session, "gpg"))) {\r
92                     fprintf (stderr, "Failed to construct gpg context.\n");\r
93 -               else\r
94 +               } else {\r
95 +                   params.decrypt = TRUE;\r
96                     g_mime_gpg_context_set_always_trust((GMimeGpgContext*)params.cryptoctx, FALSE);\r
97 +               }\r
98                 g_object_unref (session);\r
99                 session = NULL;\r
100             }\r
101 -- \r
102 1.7.5.4\r
103 \r