2 messages in net.sourceforge.lists.courier-users[courier-users] Re: An old patch at r...
FromSent OnAttachments
Scott GiffordJul 17, 2002 2:22 am 
Sam VarshavchikJul 17, 2002 7:40 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:[courier-users] Re: An old patch at rfc2045.c:495Actions...
From:Sam Varshavchik (mrs@courier-mta.com)
Date:Jul 17, 2002 7:40:45 am
List:net.sourceforge.lists.courier-users

Scott Gifford writes:

I was going through an old install of Courier-IMAP, and found a patch I hade mad way back when (to courier-imap-0.27) at what is now rfc2045.c:495. I changed:

if ((newp->mime_version=strdup(p->mime_version)) == 0) rfc2045_enomem();

to

if (p->mime_version) { if ((newp->mime_version=strdup(p->mime_version)) == 0) rfc2045_enomem(); } else { newp->mime_version=NULL; }

to fix a crash a user was seeing with no mime-version header, or an empty one, or a malformed one, or something...I can't reproduce the problem with the latest version (I no longer have the message that caused the problem), but I couldn't find an obvious guarantee that this line of code would never be reached with p->mime_version set to NULL.

Is there some reason why this is guaranteed never to happen, or should a check for NULL be put in?

A message is not recognized as a MIME message unless the Mime-Version: header is present, and additional MIME section are not parsed unless the message is considered as a MIME message.