From 75b32a4ccc813a7af1b270d7219b7203702ef87c Mon Sep 17 00:00:00 2001 Message-Id: <75b32a4ccc813a7af1b270d7219b7203702ef87c.1715617466.git.mdw@distorted.org.uk> From: Mark Wooding Date: Mon, 5 May 2008 10:48:15 +0100 Subject: [PATCH] Test a couple of bogus inputs to mime_multipart(). Organization: Straylight/Edgeware From: Richard Kettlewell --- lib/t-mime.c | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/lib/t-mime.c b/lib/t-mime.c index 65000c7..7f56c5d 100644 --- a/lib/t-mime.c +++ b/lib/t-mime.c @@ -189,7 +189,37 @@ static void test_mime(void) { "Content-Description: jpeg-1\r\n" "\r\n" ""); - + + /* Bogus inputs to mime_multipart() */ + fprintf(stderr, "expect two mime_multipart errors:\n"); + insist(mime_multipart("--inner\r\n" + "Content-Type: text/plain\r\n" + "Content-Disposition: inline\r\n" + "Content-Description: text-part-2\r\n" + "\r\n" + "Some more text here.\r\n" + "\r\n" + "--inner\r\n" + "Content-Type: image/jpeg\r\n" + "Content-Disposition: attachment\r\n" + "Content-Description: jpeg-1\r\n" + "\r\n" + "\r\n", + test_multipart_callback, + "inner", + parts) == -1); + insist(mime_multipart("--wrong\r\n" + "Content-Type: text/plain\r\n" + "Content-Disposition: inline\r\n" + "Content-Description: text-part-2\r\n" + "\r\n" + "Some more text here.\r\n" + "\r\n" + "--inner--\r\n", + test_multipart_callback, + "inner", + parts) == -1); + /* XXX mime_parse */ check_string(mime_qp(""), ""); -- [mdw]