aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--notmuch-dump.c12
-rw-r--r--test/random-corpus.c4
2 files changed, 15 insertions, 1 deletions
diff --git a/notmuch-dump.c b/notmuch-dump.c
index d2dad40d..5bbda360 100644
--- a/notmuch-dump.c
+++ b/notmuch-dump.c
@@ -102,6 +102,18 @@ notmuch_dump_command (unused (void *ctx), int argc, char *argv[])
message = notmuch_messages_get (messages);
message_id = notmuch_message_get_message_id (message);
+ if (output_format == DUMP_FORMAT_BATCH_TAG &&
+ strchr (message_id, '\n')) {
+ /* This will produce a line break in the output, which
+ * would be difficult to handle in tools. However, it's
+ * also impossible to produce an email containing a line
+ * break in a message ID because of unfolding, so we can
+ * safely disallow it. */
+ fprintf (stderr, "Warning: skipping message id containing line break: \"%s\"\n", message_id);
+ notmuch_message_destroy (message);
+ continue;
+ }
+
if (output_format == DUMP_FORMAT_SUP) {
fprintf (output, "%s (", message_id);
}
diff --git a/test/random-corpus.c b/test/random-corpus.c
index f354d4b9..8b7748ef 100644
--- a/test/random-corpus.c
+++ b/test/random-corpus.c
@@ -96,7 +96,9 @@ random_utf8_string (void *ctx, size_t char_count)
buf = talloc_realloc (ctx, buf, gchar, buf_size);
}
- randomchar = random_unichar ();
+ do {
+ randomchar = random_unichar ();
+ } while (randomchar == '\n');
written = g_unichar_to_utf8 (randomchar, buf + offset);