From: Jani Nikula <jani@nikula.org>
To: notmuch@notmuchmail.org
Subject: [PATCH v2 1/6] cli: fix use of uninitialized variable in "notmuch reply"
Date: Sun, 8 Jan 2012 23:48:30 +0200 [thread overview]
Message-ID: <974a2ef1f1df7d93e0b5bd642ca8a49f8b727a86.1326058946.git.jani@nikula.org> (raw)
In-Reply-To: <cover.1326058946.git.jani@nikula.org>
In-Reply-To: <cover.1326058946.git.jani@nikula.org>
notmuch_show_params_t params is only initialized partially in
notmuch_reply_command(). The only field that is used uninitialized is
params.decrypt. It is usually non-zero, making "notmuch reply" on encrypted
messages work by coincidence.
Initialize params properly, and set params.decrypt as needed.
Signed-off-by: Jani Nikula <jani@nikula.org>
---
notmuch-reply.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/notmuch-reply.c b/notmuch-reply.c
index f8d5f64..1f33a86 100644
--- a/notmuch-reply.c
+++ b/notmuch-reply.c
@@ -621,11 +621,9 @@ notmuch_reply_command (void *ctx, int argc, char *argv[])
char *opt, *query_string;
int i, ret = 0;
int (*reply_format_func)(void *ctx, notmuch_config_t *config, notmuch_query_t *query, notmuch_show_params_t *params);
- notmuch_show_params_t params;
+ notmuch_show_params_t params = { .part = -1 };
reply_format_func = notmuch_reply_format_default;
- params.part = -1;
- params.cryptoctx = NULL;
argc--; argv++; /* skip subcommand argument */
@@ -647,10 +645,12 @@ notmuch_reply_command (void *ctx, int argc, char *argv[])
} else if ((STRNCMP_LITERAL (argv[i], "--decrypt") == 0)) {
if (params.cryptoctx == NULL) {
GMimeSession* session = g_object_new(g_mime_session_get_type(), NULL);
- if (NULL == (params.cryptoctx = g_mime_gpg_context_new(session, "gpg")))
+ if (NULL == (params.cryptoctx = g_mime_gpg_context_new(session, "gpg"))) {
fprintf (stderr, "Failed to construct gpg context.\n");
- else
+ } else {
+ params.decrypt = TRUE;
g_mime_gpg_context_set_always_trust((GMimeGpgContext*)params.cryptoctx, FALSE);
+ }
g_object_unref (session);
session = NULL;
}
--
1.7.5.4
next prev parent reply other threads:[~2012-01-08 21:48 UTC|newest]
Thread overview: 81+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-05 20:25 [PATCH 0/4] notmuch reply bugfix & reply to sender only Jani Nikula
2012-01-05 20:25 ` [PATCH 1/4] cli: fix use of uninitialized variable in "notmuch reply" Jani Nikula
2012-01-06 3:22 ` David Bremner
2012-01-06 8:11 ` Jani Nikula
2012-01-06 11:57 ` David Bremner
2012-01-07 3:52 ` David Bremner
2012-01-07 7:31 ` Jani Nikula
2012-01-07 11:57 ` Mark Walters
2012-01-07 12:14 ` David Bremner
2012-01-05 20:25 ` [PATCH 2/4] cli: convert "notmuch reply" to use the new argument parser Jani Nikula
2012-01-05 20:25 ` [PATCH 3/4] cli: add support for replying just to the sender in "notmuch reply" Jani Nikula
2012-01-05 20:25 ` [PATCH 4/4] emacs: add support for replying just to the sender of messages and threads Jani Nikula
2012-01-05 20:33 ` [PATCH 0/4] notmuch reply bugfix & reply to sender only Jameson Graef Rollins
2012-01-07 19:25 ` Mueen Nawaz
2012-01-05 22:01 ` Mark Walters
2012-01-06 12:34 ` Jani Nikula
2012-01-06 13:32 ` Mark Walters
2012-01-06 13:34 ` [PATCH 1/4] Add the option "--reply-to" to notmuch reply Mark Walters
2012-01-08 12:47 ` Jani Nikula
2012-01-08 15:08 ` Mark Walters
2012-01-08 16:11 ` Jani Nikula
2012-01-06 13:34 ` [PATCH 2/4] Update the man page for notmuch-reply to give the syntax for the --reply-to option Mark Walters
2012-01-06 13:34 ` [PATCH 3/4] Emacs changes for reply-to-sender Mark Walters
2012-01-06 13:34 ` [PATCH 4/4] add tests " Mark Walters
2012-01-06 14:20 ` [PATCH 0/4] notmuch reply bugfix & reply to sender only Mark Walters
2012-01-06 0:01 ` Adam Wolfe Gordon
2012-01-06 22:11 ` Tomi Ollila
2012-01-06 8:54 ` David Edmondson
2012-01-08 21:48 ` [PATCH v2 0/6] reply to sender Jani Nikula
2012-01-09 8:22 ` David Edmondson
2012-01-09 18:55 ` Dmitry Kurochkin
2012-01-08 21:48 ` Jani Nikula [this message]
2012-01-08 21:48 ` [PATCH v2 2/6] cli: convert "notmuch reply" to use the new argument parser Jani Nikula
2012-01-08 21:48 ` [PATCH v2 3/6] cli: add support for replying just to the sender in "notmuch reply" Jani Nikula
2012-01-08 23:23 ` Mark Walters
2012-01-09 9:41 ` Jani Nikula
2012-01-09 11:13 ` Mark Walters
2012-01-08 21:48 ` [PATCH v2 4/6] emacs: add support for replying just to the sender Jani Nikula
2012-01-08 21:48 ` [PATCH v2 5/6] emacs: bind 'r' to reply-to-sender and 'R' to reply-to-all Jani Nikula
2012-01-08 22:01 ` Jeremy Nickurak
2012-01-08 23:32 ` Jameson Graef Rollins
2012-01-08 23:56 ` Jeremy Nickurak
2012-01-09 14:10 ` is there a default reply function? (was: Re: [PATCH v2 5/6] emacs: bind 'r' to reply-to-sender and 'R' to reply-to-all) Gregor Zattler
2012-01-08 21:48 ` [PATCH v2 6/6] test: add tests for "notmuch reply" --reply-to=sender Jani Nikula
2012-01-10 19:54 ` [PATCH v3 0/4] reply to sender Jani Nikula
2012-01-10 19:54 ` [PATCH v3 1/4] cli: add support for replying just to the sender in "notmuch reply" Jani Nikula
2012-01-12 3:31 ` Austin Clements
2012-01-10 19:54 ` [PATCH v3 2/4] emacs: add support for replying just to the sender Jani Nikula
2012-01-11 8:20 ` David Edmondson
2012-01-11 8:45 ` Jani Nikula
2012-01-11 9:08 ` David Edmondson
2012-01-11 21:15 ` Aaron Ecay
2012-01-11 22:08 ` Jani Nikula
2012-01-10 19:54 ` [PATCH v3 3/4] emacs: bind 'r' to reply-to-sender and 'R' to reply-to-all Jani Nikula
2012-01-11 8:21 ` David Edmondson
2012-01-10 19:54 ` [PATCH v3 4/4] test: add tests for "notmuch reply" --reply-to=sender Jani Nikula
2012-01-12 3:50 ` Austin Clements
2012-01-12 12:59 ` Tomi Ollila
2012-01-12 21:40 ` [PATCH v4 0/5] reply to sender Jani Nikula
2012-01-12 21:40 ` [PATCH v4 1/5] cli: slightly refactor "notmuch reply" address scanning functions Jani Nikula
2012-01-12 21:59 ` Austin Clements
2012-01-14 14:22 ` Jani Nikula
2012-01-12 23:28 ` Mark Walters
2012-01-12 21:40 ` [PATCH v4 2/5] cli: add support for replying just to the sender in "notmuch reply" Jani Nikula
2012-01-12 22:02 ` Austin Clements
2012-01-12 23:46 ` Mark Walters
2012-01-12 21:40 ` [PATCH v4 3/5] emacs: add support for replying just to the sender Jani Nikula
2012-01-12 21:40 ` [PATCH v4 4/5] emacs: bind 'r' to reply-to-sender and 'R' to reply-to-all Jani Nikula
2012-01-12 21:40 ` [PATCH v4 5/5] test: add tests for "notmuch reply" --reply-to=sender Jani Nikula
2012-01-14 14:46 ` [PATCH v5 0/5] reply to sender Jani Nikula
2012-01-14 14:46 ` [PATCH v5 1/5] cli: slightly refactor "notmuch reply" address scanning functions Jani Nikula
2012-01-14 15:31 ` David Bremner
2012-01-14 16:48 ` Jani Nikula
2012-01-16 18:06 ` Dmitry Kurochkin
2012-01-16 18:40 ` David Edmondson
2012-01-16 19:26 ` David Bremner
2012-01-16 19:32 ` Jameson Graef Rollins
2012-01-14 14:46 ` [PATCH v5 2/5] cli: add support for replying just to the sender in "notmuch reply" Jani Nikula
2012-01-14 14:46 ` [PATCH v5 3/5] emacs: add support for replying just to the sender Jani Nikula
2012-01-14 14:46 ` [PATCH v5 4/5] emacs: bind 'r' to reply-to-sender and 'R' to reply-to-all Jani Nikula
2012-01-14 14:46 ` [PATCH v5 5/5] test: add tests for "notmuch reply" --reply-to=sender Jani Nikula
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=974a2ef1f1df7d93e0b5bd642ca8a49f8b727a86.1326058946.git.jani@nikula.org \
--to=jani@nikula.org \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).