commit b08d2e8426b3b8dbe1020b926ce748ea60fe6bcd
parent c0643797a45a87d020aff006c77be923b034d402
Author: Christoph Lohmann <20h@r-36.net>
Date: Sat, 4 Oct 2025 21:48:56 +0200
Fix heuristics for badly header in body.
Diffstat:
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/mime.c b/mime.c
@@ -970,12 +970,14 @@ mime_parsebufintern(mime_t *mime, char *str, int len)
goto mimeparsebufbodyparse;
}
/*
- * Does the line have some "header:
- * value\n" form? Go on parsing headers.
+ * TODO: Find Apple and Google developers
+ * and teach them how to not do this.
+ * Does the line have some "header: value\n"
+ * form? Go on parsing headers.
*/
for (key = p; key[0] != '\n'; key++) {
//printf("key[0] = '%c'\n", key[0]);
- if (key[0] == ':')
+ if (key[0] == ':' && key[1] == ' ')
break;
if (key[0] == ' ') {
mime->rawhdrs = memdupz(str, (p - str));
@@ -984,8 +986,8 @@ mime_parsebufintern(mime_t *mime, char *str, int len)
}
}
/*
- * A line simply ended with no header
- * suspicion.
+ * A line simply ended with no header.
+ * That is suspicious.
*/
if (key[0] == '\n') {
mime->rawhdrs = memdupz(str, (p - str));