Bug 3364

Summary: segfault in src/prefs_account.c
Product: Claws Mail (GTK 2) Reporter: Michael Schwendt <mschwendt>
Component: UIAssignee: users
Status: RESOLVED FIXED    
Severity: normal    
Priority: P3    
Version: 3.11.1   
Hardware: PC   
OS: Linux   
Attachments:
Description Flags
Fix proposal none

Description Michael Schwendt 2015-01-14 16:02:09 UTC
http://git.claws-mail.org/?p=claws.git;a=blob;f=src/prefs_account.c;h=934a1cf6d562ba3d51332ee9363a3f029878ccb4;hb=HEAD#l3847

3847         if (strchr(address, '@') == NULL) {
3848                 g_free(address);
3849                 gtk_label_set_text(GTK_LABEL(basic_page.auto_configure_lbl),
3850                            _("Failed (wrong address)"));
3851         }
3852         domain = strchr(address, '@') + 1;

The error-handling for the case "no @ found in address" frees the address ptr, but accesses it in line 3852 again. domain ptr becomes 0x1 causing a crash later.

https://bugzilla.redhat.com/1182146
Comment 1 Ricardo Mones 2015-01-14 16:39:15 UTC
Created attachment 1470 [details]
Fix proposal

The attached patch fixes it for me (and the double free while we're at it ;-)
Comment 2 users 2015-01-14 16:50:02 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	2015-01-14 16:50:02.435589581 +0100
http://git.claws-mail.org/?p=claws.git;a=commitdiff;h=00729e26d5d3e849874f45a59ddd578a43860b62
Merge: 0a0b2b2 c0810db
Author: Colin Leroy <colin@colino.net>
Date:   Wed Jan 14 16:50:01 2015 +0100

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

http://git.claws-mail.org/?p=claws.git;a=commitdiff;h=c0810db8bfb77999ceae738e88c7ff11352bb366
Author: Colin Leroy <colin@colino.net>
Date:   Wed Jan 14 16:46:21 2015 +0100

    Fix bug #3364, segfault in src/wizard.c: add missing return
    Fix bug #3365, segfault in src/prefs_account.c: add missing return