All line numbers will refer to version 3.14.0 and the file imap.c! I have a plugin running, that returns the password from gnome-keyring, i.e. imap.c:1285 will run successfully, and we will end up in the block with lines 1287 and 1288. Line 1287 is the problem here, because we use Xstrdup_a(acc_pass...) which uses internally alloca, thus the memory is automatically managed. However in all following code (and in my case in line 1341), the memory for acc_pass will be freed with g_free. This leads to a segmentation fault on my PC. I guess this bug was introduced due to the new passwordstore in claws-mail...
You're right, this is a problem. The use of alloca() here is, I believe, incorrect, since the returned password could be of any length, and could cause stack overflow. It needs to be changed to use simple malloc() instead. Sorry about that.
To be honest, I've just changed it to not copy at all, just set the pointer correctly with acc_pass = pass; and removing the two lines for copying/freeing the variable pass. I think this is from old implementations, where acc_pass was deleted automatically. Now in all cases acc_pass will be freed anyway, and pass is already allocated with malloc, so I don't see the point, why copying it just another time ;)
Created attachment 1673 [details] A fix for the crash Can you try this patch (against current git master)? You are correct that this was an oversight during recent password-related changes. Sorry about that.
Yes it works now. Thank you very much for the fast fix ;)
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 2016-08-17 00:34:03.974036385 +0200 http://git.claws-mail.org/?p=claws.git;a=commitdiff;h=b23c6b4ca22574e99dfff6cb13211f539ff8536d Merge: aff003f 5b70872 Author: Colin Leroy <colin@colino.net> Date: Wed Aug 17 00:34:03 2016 +0200 Merge branch 'master' of file:///home/git/claws http://git.claws-mail.org/?p=claws.git;a=commitdiff;h=5b70872b46999db1d46718267a4960547147d46b Author: Andrej Kacian <ticho@claws-mail.org> Date: Wed Aug 17 00:32:12 2016 +0200 Fix a crash on IMAP login when using a password plugin. Fixes bug #3667.
Patch applied in git, thanks for reporting!