Bug 3924 - Fix configuration of sieve plugin on FreeBSD (segfaulted)
Summary: Fix configuration of sieve plugin on FreeBSD (segfaulted)
Status: RESOLVED FIXED
Alias: None
Product: Claws Mail (GTK 2)
Classification: Unclassified
Component: Plugins/ManageSieve (show other bugs)
Version: 3.16.0
Hardware: PC FreeBSD
: P3 normal
Assignee: users
URL:
Depends on:
Blocks:
 
Reported: 2017-11-26 21:20 UTC by Michael Gmelin
Modified: 2017-11-27 14:44 UTC (History)
0 users

See Also:


Attachments
Small patch (use "git am") to unbreak sieve config on FreeBSD (2.22 KB, patch)
2017-11-26 21:20 UTC, Michael Gmelin
no flags Details | Diff

Description Michael Gmelin 2017-11-26 21:20:13 UTC
Created attachment 1819 [details]
Small patch (use "git am") to unbreak sieve config on FreeBSD

This patch treats FreeBSD like OpenBSD in the configuration. "%ms" seems GNU/Linux specific so maybe reversing the logic might be better.

Also, add extra check when accessing config->host to make sure it isn't null.

Patch is suitable for use with "git am".

Also affects latest release (3.15.1).
Comment 1 users 2017-11-27 13:18:03 UTC
Changes related to this bug have been committed.
Please check latest Git and update the bug accordingly.
You can also get the patch from:
http://git.claws-mail.org/

++ ChangeLog	2017-11-27 13:18:03.298951295 +0100
http://git.claws-mail.org/?p=claws.git;a=commitdiff;h=6e6a6fe02182423fe7d723dc290ccfc1701a4642
Merge: 77c3e57 a4b3b84
Author: Colin Leroy <colin@colino.net>
Date:   Mon Nov 27 13:18:02 2017 +0100

    Merge branch 'master' of file:///home/git/claws

http://git.claws-mail.org/?p=claws.git;a=commitdiff;h=a4b3b845e91a3d12a81d372b8635eaf76923071f
Author: Michael Gmelin <freebsd@grem.de>
Date:   Sun Nov 26 21:09:22 2017 +0100

    Fix bug #3924: Unbreak sieve host configuration on FreeBSD
    
    Also, adds extra check for config->host
Comment 2 Ricardo Mones 2017-11-27 13:18:40 UTC
Thanks for the patch!
Comment 3 Michael Gmelin 2017-11-27 13:30:12 UTC
Thanks for applying the patch so quickly.

Please note that it might make sense to simply make the code for win/openbsd and freebsd the default and get rid of the ifdefs. I don't think using "%ms" buys that much and it might still break on mac os x, netbsd etc. in its current state.

My itch has been scratched though, so thank you again.
Comment 4 Ricardo Mones 2017-11-27 14:08:05 UTC
(In reply to comment #3)
> Thanks for applying the patch so quickly.
> 
> Please note that it might make sense to simply make the code for win/openbsd
> and freebsd the default and get rid of the ifdefs. I don't think using "%ms"
> buys that much and it might still break on mac os x, netbsd etc. in its
> current state.

Well, it's very convenient to avoid dealing with fixed-length buffers in the application and let the underlying library do it better :-)

https://stackoverflow.com/questions/38685724/difference-between-ms-and-s-scanf

Haven't heard about others breaking, but maybe there's a better way to protect the %ms usage with feature flags.
Comment 5 Michael Gmelin 2017-11-27 14:44:02 UTC
(In reply to comment #4)
> (In reply to comment #3)
> > Thanks for applying the patch so quickly.
> > 
> > Please note that it might make sense to simply make the code for win/openbsd
> > and freebsd the default and get rid of the ifdefs. I don't think using "%ms"
> > buys that much and it might still break on mac os x, netbsd etc. in its
> > current state.
> 
> Well, it's very convenient to avoid dealing with fixed-length buffers in the
> application and let the underlying library do it better :-)
> 
> https://stackoverflow.com/questions/38685724/difference-between-ms-and-s-
> scanf
> 
> Haven't heard about others breaking, but maybe there's a better way to
> protect the %ms usage with feature flags.

It's certainly convenient when you work on just one platform that supports it (and safer too). As claws is multi-platform, you end up with a lot more code to maintain and test (and leaving some platforms vulnerable). Even with feature flags you would end up with mupltiple code paths, so I'm not sure how it's useful in this case. If anything, some sort of project-global wrapper could make sense. Anyway, like I said, it works for me now :)

Note You need to log in before you can comment on or make changes to this bug.