From 41bd429452f45cb43110ec4699871a2cbd9c0a5e Mon Sep 17 00:00:00 2001 From: Leah Neukirchen Date: Mon, 30 Aug 2021 17:49:32 +0200 Subject: blaze822: blaze822/blaze822_mem: detect line ending before scanning end of header A mail using CRLF which contained (for some reason) a LFLF pair would be misparsed as the header was read until the LFLF. Instead, scan for the first LF, check if it's preceded by CR, and then search for the proper header terminator only. Closes #212. --- t/1701-mshow-regress.t | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100755 t/1701-mshow-regress.t (limited to 't') diff --git a/t/1701-mshow-regress.t b/t/1701-mshow-regress.t new file mode 100755 index 0000000..ffb676d --- /dev/null +++ b/t/1701-mshow-regress.t @@ -0,0 +1,29 @@ +#!/bin/sh -e +cd ${0%/*} +. ./lib.sh +plan 2 + +# Mail with \n\n and \r\n\r\n +cr=$(printf '\r') +cat <tmp +Content-Type: multipart/form-data; boundary=------------------------55a586f81559face$cr +$cr +--------------------------55a586f81559face$cr +Content-Disposition: form-data; name="a"; filename="foo"$cr +Content-Type: application/octet-stream$cr +$cr +foo$cr + +previously there are two NL$cr +$cr +--------------------------55a586f81559face$cr +Content-Disposition: form-data; name="a"; filename="bar"$cr +Content-Type: application/octet-stream$cr +$cr +bar$cr +$cr +--------------------------55a586f81559face--$cr +EOF + +check 'mail has 3 attachments' 'mshow -t ./tmp | wc -l | grep 4' +check 'mail attachment foo has size 35' 'mshow -t ./tmp | grep size=35.*name=\"foo\"' -- cgit 1.4.1