[pkg-fetchmail-maint] Bug#416625: fetchmail: segfaults if bsmtp file can't be opened

Nico Golde nion at debian.org
Thu Mar 29 13:33:38 UTC 2007


Hi,
* Reto Schuettel <reto at schuettel.ch> [2007-03-29 14:21]:
> Subject: fetchmail: segfaults if bsmtp file can't be opened
> Package: fetchmail
> Version: 6.3.6-1
> Severity: normal
> 
> fetchmail segfaults if the specified bsmtp file can't be opened (e.g. if it the parent
> folder doesn't exist). 
> 
> * fetchmail manpage
> |       bsmtp              -o           Specify BSMTP batch file to
> |       append
> 
> I compiled fetchmail with debug symbols and I think I found the 
> location of the bug.
> 
> sink.c:
> 
>  706     if (strcmp(ctl->bsmtp, "-") == 0)
>  707         sinkfp = stdout;
>  708     else
>  709         sinkfp = fopen(ctl->bsmtp, "a");
>  710 
>  711     /* see the ap computation under the SMTP branch */
>  712     need_anglebrs = (msg->return_path[0] != '<');
>  713     fprintf(sinkfp,
>  714             "MAIL FROM:%s%s%s",
>  715             need_anglebrs ? "<" : "",
>  716             (msg->return_path[0]) ? msg->return_path : user,
>  717             need_anglebrs ? ">" : "");
> 
> I guess fetchmail should check if the open was successful :).

The funny thing is that there already is a check for this 
but at the wrong place :)
At the end of the function:

 743     if (ferror(sinkfp))
 744     {
 745     report(stderr, GT_("BSMTP file open or preamble write failed\n"));
 746     return(PS_BSMTP);
 747     }

I send a patch to upstream. Thanks for your excellent bug report!
Kind regards
Nico

-- 
Nico Golde - http://www.ngolde.de
JAB: nion at jabber.ccc.de - GPG: 0x73647CFF
Forget about that mouse with 3/4/5 buttons,
gimme a keyboard with 103/104/105 keys!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.alioth.debian.org/pipermail/pkg-fetchmail-maint/attachments/20070329/bbd571e3/attachment.pgp


More information about the pkg-fetchmail-maint mailing list