aboutsummaryrefslogtreecommitdiffhomepage
path: root/notmuch-reply.c
diff options
context:
space:
mode:
authorGravatar Jani Nikula <jani@nikula.org>2014-03-19 18:44:50 +0200
committerGravatar David Bremner <david@tethera.net>2014-03-25 21:22:03 -0300
commit31a6333aa46fc8125d2fe1effd6fddf48e47c14e (patch)
tree9148e42a44e0b479b3295766b026f39ad82f89f2 /notmuch-reply.c
parentb6238f7e510b26e49d7ba91c687ca22e2f07882d (diff)
cli: sanitize the received header before scanning for replies
This makes the from guessing agnostic to header folding by spaces or tabs.
Diffstat (limited to 'notmuch-reply.c')
-rw-r--r--notmuch-reply.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/notmuch-reply.c b/notmuch-reply.c
index 47993d22..7c1c8095 100644
--- a/notmuch-reply.c
+++ b/notmuch-reply.c
@@ -21,6 +21,7 @@
*/
#include "notmuch-client.h"
+#include "string-util.h"
#include "sprinter.h"
static void
@@ -465,14 +466,21 @@ guess_from_in_received_headers (notmuch_config_t *config,
notmuch_message_t *message)
{
const char *received, *addr;
+ char *sanitized;
received = notmuch_message_get_header (message, "received");
if (! received)
return NULL;
- addr = guess_from_in_received_for (config, received);
+ sanitized = sanitize_string (NULL, received);
+ if (! sanitized)
+ return NULL;
+
+ addr = guess_from_in_received_for (config, sanitized);
if (! addr)
- addr = guess_from_in_received_by (config, received);
+ addr = guess_from_in_received_by (config, sanitized);
+
+ talloc_free (sanitized);
return addr;
}