Commit Graph

81 Commits

Author SHA1 Message Date
Leah Neukirchen
41bd429452 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.
2021-08-30 18:12:30 +02:00
Leah Neukirchen
4be6e0ce91 blaze822: remove blaze822_mmap, never used. 2021-08-30 18:12:09 +02:00
Leah Neukirchen
e7442fcc72 seq: - now refers to the message on stdin, use .- for previous message 2020-07-03 17:26:48 +02:00
Leah Neukirchen
e56f8ad294 blaze822: blaze822_addr: null-terminate ttok at the current position before appending 2020-04-03 22:46:35 +02:00
Leah Neukirchen
3370fd5f70 blaze822: blaze822_addr: don't force add space before quoted words 2020-04-03 22:10:58 +02:00
Leah Neukirchen
8c8a4bd422 blaze822: blaze822_addr: ignore leading obs-route 2020-04-03 21:31:02 +02:00
Leah Neukirchen
604afb5011 mytimegm: replace with own implementation 2020-03-28 21:29:34 +01:00
Leah Neukirchen
081a9404cd blaze822: blaze822_addr: fix parsing of () at end of string
Found by lhynes.
2019-03-01 15:43:38 +01:00
Leah Neukirchen
11ae5504fd blaze822: blaze822_addr: don't read over the trailing nul byte when resolving \ 2019-02-28 14:59:12 +01:00
Leah Neukirchen
9dfbf48be4 blaze822: blaze822_addr: take care of string end in comments inside < 2019-02-28 14:28:14 +01:00
Leah Neukirchen
01b2f1abc6 blaze822: blaze822_addr: skip remaining characters when token is full, also with [ 2019-02-27 23:21:55 +01:00
Leah Neukirchen
5a8bb16289 blaze822: blaze822_addr: skip remaining characters when token is full 2019-02-27 22:58:00 +01:00
Leah Neukirchen
5fc3115c3f blaze822: blaze822_addr: don't drop last char when comment is not closed
Found by duncaen with afl.
2019-02-27 22:43:15 +01:00
Leah Neukirchen
3d3fffd7e8 blaze822: blaze822_addr: fix reading over the end of address if it ends with , or ;
Found by duncaen with afl.
2019-02-27 22:42:15 +01:00
Leah Neukirchen
3f2c714b42 blaze822: safe_append: fixes for various border cases
This fixes dstmax == dstlen and when src is completely full.

Found by duncaen with afl.
2019-02-27 22:40:13 +01:00
Leah Neukirchen
6ea32480f1 blaze822: blaze822_mmap: fix memleak
Found by clang 7.0.1.
2019-02-10 22:03:45 +01:00
Leah Neukirchen
4198cd42fa blaze822: blaze822_mem: fix memleak
Found by clang 7.0.1.
2019-02-10 22:03:09 +01:00
Leah Neukirchen
adb5850983 blaze822: safe_append: avoid different signedness in comparison 2019-02-03 18:03:13 +01:00
Leah Neukirchen
35c11688eb blaze822: compress_hdr: avoid stepping h too far
This resulted in the message consisting of the empty line to contain a
single header which consisted of only a space.
2018-03-02 20:43:01 +01:00
Leah Neukirchen
2708f184e9 blaze822: blaze822_addr: empty ttok after using it 2018-01-14 21:38:20 +01:00
Leah Neukirchen
86b08d1925 blaze822: blaze822_addr: spaces in local-part need quoting too 2018-01-14 21:25:19 +01:00
Leah Neukirchen
4e18bb2131 blaze822: blaze822_addr: make < in <> reset mail address parsing 2018-01-14 21:06:56 +01:00
Leah Neukirchen
fce30ace50 blaze822: blaze822_addr: move previous addr contents to disp 2018-01-13 21:31:22 +01:00
Leah Neukirchen
09c92d5dd8 blaze822: blaze822_addr: <> always resets the address 2018-01-13 21:28:43 +01:00
Leah Neukirchen
effc645f8a blaze822: safe_append: off by one 2018-01-13 21:27:54 +01:00
Leah Neukirchen
a5026c9b99 blaze822: blaze822_addr: rewrite address parsing
This hopefully fixes many bugs and subtleties related to extracting
adresses.
2018-01-07 20:42:53 +01:00
Leah Neukirchen
be6bbf6056 blaze822: blaze822_addr: ensure strlen is not run on null pointer
Found by Larry Hynes.
2017-10-08 21:15:49 +02:00
Leah Neukirchen
ce9ac3aff4 blaze822: blaze822_addr: quote local-part if needed 2017-10-03 23:43:59 +02:00
Leah Neukirchen
66d0eff12f style 2017-08-31 17:30:17 +02:00
Leah Neukirchen
635dfe95ad blaze822: blaze822_addr: support backslashes in atoms
This happens a lot in the real world, even if it's not RFC conforming.
2017-06-13 17:18:05 +02:00
Leah Neukirchen
ea32b6a45e blaze822: blaze822_addr: ensure space for terminal null 2017-06-13 17:09:54 +02:00
Leah Neukirchen
4ac581b131 blaze822: blaze822_addr: unquote quoted strings 2017-06-12 16:26:50 +02:00
Leah Neukirchen
4d2607fe21 blaze822: blaze822_addr: skip spaces after > 2017-06-03 17:24:14 +02:00
Leah Neukirchen
10a011b94e blaze822: blaze822_addr: use memcpy instead of strcpy, we know the length 2017-06-03 17:23:41 +02:00
Leah Neukirchen
2b4e3aa66d clean up whitespace 2017-01-26 20:27:26 +01:00
Christian Neukirchen
06cc4bd693 mblaze822: blaze822_addr: add simple group parsing
Just ignores the group name, and considers ; an address separator too.
2016-09-07 15:50:59 +02:00
Christian Neukirchen
e725365d45 blaze822: blaze822_addr: add bounds check when extracting display name
Discovered using the TREC 2005 Spam Public Corpora.
http://plg.uwaterloo.ca/~gvcormac/treccorpus/README.html
2016-09-01 15:38:21 +02:00
Christian Neukirchen
4bb35cbead blaze822: blaze822_addr: make a bit more robust
Start over when seeing another < in the address part.

Support "..." in the address part.
2016-08-09 15:49:59 +02:00
Christian Neukirchen
d458439970 import and use timegm from musl
It's ridiculous this function is not in the standards.
2016-08-08 16:28:25 +02:00
Christian Neukirchen
7575e07b9f blaze822: keep a pointer to the original header, if we have it anyway 2016-08-06 19:27:02 +02:00
Christian Neukirchen
2aaa3cecd8 blaze822: blaze822_chdr: downcase header 2016-08-01 00:04:35 +02:00
Christian Neukirchen
4296c369f6 blaze822: blaze822_hdr_: off-by-one for first header 2016-07-29 18:26:39 +02:00
Christian Neukirchen
7636f0977c blaze822: blaze822_file: allocate enough space for read 2016-07-29 15:41:41 +02:00
Christian Neukirchen
3d0c2f8b47 cleanups 2016-07-26 22:15:30 +02:00
Christian Neukirchen
fc4c696e3d blaze822: blaze822_file: allow unknown file size (e.g. pipes) 2016-07-26 19:39:27 +02:00
Christian Neukirchen
6592bdb912 import musl memmem 2016-07-26 18:10:39 +02:00
Christian Neukirchen
182a32ff9d blaze822: blaze822_addr: return 0 when no address is found
Also return null pointers instead of empty strings.
2016-07-25 13:10:35 +02:00
Christian Neukirchen
ac679b264c blaze822: fix header finding with CRLF 2016-07-21 20:37:10 +02:00
Christian Neukirchen
98c03d9023 blaze822: forgot to free
Found by clang-analyzer.
2016-07-21 20:27:33 +02:00
Christian Neukirchen
c12aa23777 blaze822: fix months. duh 2016-07-18 18:11:41 +02:00