(fix) handle when mail starts with Bcc header (fixes #4073)

pull/234/head
Ludovic Marcotte 2017-03-08 08:42:56 -05:00
parent 0ffbc13376
commit 4ae8961947
1 changed files with 11 additions and 3 deletions

View File

@ -356,9 +356,17 @@
// we find \r\n\r\n, which is the headers delimiter
r1 = [cleaned_message rangeOfCString: "\r\n\r\n"];
limit = r1.location-1;
r1 = [cleaned_message rangeOfCString: "\r\nBcc: "
// We check if the mail actually *starts* with the Bcc: header
r1 = [cleaned_message rangeOfCString: "Bcc: "
options: 0
range: NSMakeRange(0,limit)];
range: NSMakeRange(0,5)];
// It does not, let's search in the entire headers
if (r1.location == NSNotFound)
r1 = [cleaned_message rangeOfCString: "\r\nBcc: "
options: 0
range: NSMakeRange(0,limit)];
if (r1.location != NSNotFound)
{
@ -374,7 +382,7 @@
break;
}
[cleaned_message replaceBytesInRange: NSMakeRange(r1.location, i-r1.location)
[cleaned_message replaceBytesInRange: NSMakeRange(r1.location, i-r1.location+2)
withBytes: NULL
length: 0];
}