After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 730985 - problem with BOM in header
problem with BOM in header
Status: RESOLVED NOTABUG
Product: gmime
Classification: Other
Component: general
2.6.x
Other Linux
: Normal normal
: ---
Assigned To: Jeffrey Stedfast
Jeffrey Stedfast
Depends on:
Blocks:
 
 
Reported: 2014-05-30 09:30 UTC by a.amann
Modified: 2014-05-30 10:22 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
mail which demonstrates the problem (2.54 KB, text/plain)
2014-05-30 09:32 UTC, a.amann
Details
minimal program which demonstrates bug (adapted from gmime/examples/basic-example.c)) (2.42 KB, text/plain)
2014-05-30 09:33 UTC, a.amann
Details

Description a.amann 2014-05-30 09:30:26 UTC
I have some spam mails, which have a utf-16 byte order mark
(BOM) U+FEFF as the first character in one of their "Received:"
lines, before the "From", etc. header lines. When I do 

g_mime_object_get_header (GMIME_OBJECT(message),"From")

I simply get the string "(null)", but not the actual "From" field.  I
suspect that gmime chokes on parsing the BOM, and considers the
remainder of the message to be part of the body.  Is this the expected
behavior or is this a bug in gmime? 

Maybe gmime could simply ignore BOMs independent of whether they appear
in the header or body of a message?

Attached find a sample mail and a minimal program which demonstrates the problem. 
The program tries to read the "received" and the "from" header from the supplied email. However, it only succeeds in obtaining the "Received" header (which is before the BOM) and not the "From" header which is after. Expected behaviour would be that both headers are successfully parsed.
Comment 1 a.amann 2014-05-30 09:32:12 UTC
Created attachment 277522 [details]
mail which demonstrates the problem
Comment 2 a.amann 2014-05-30 09:33:40 UTC
Created attachment 277523 [details]
minimal program which demonstrates bug (adapted from gmime/examples/basic-example.c))
Comment 3 Jeffrey Stedfast 2014-05-30 10:22:44 UTC
The problem isn't the BOM, the problem is the blank line before the Received header.

A blank line terminates the header block.