Bug 3265

Summary: procmime.c: unbalanced flockfile() / funlockfile()
Product: Claws Mail (GTK 2) Reporter: Timo Teräs <timo.teras>
Component: OtherAssignee: users
Status: RESOLVED FIXED    
Severity: normal    
Priority: P3    
Version: 3.10.1   
Hardware: PC   
OS: Linux   
Attachments:
Description Flags
proposed fix none

Description Timo Teräs 2014-09-05 12:23:42 UTC
Created attachment 1427 [details]
proposed fix

procmime_decode_content() opens file with get_tmpfile_in_dir(), but uses procmime_fclose() to close it which calls funlockfile() for it too. It is undefined what happens - and some c-libraries crash, or abort with assertation failure.

See attached patch to fix it.
Comment 1 Natanael Copa 2014-09-08 09:12:43 UTC
Looks correct to me.

I wonder if it might be an idea to add a wrapper for procmime_get_tmpfile_in_dir()
Comment 2 users 2014-09-12 08:13: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	2014-09-12 08:13:02.738300504 +0200
http://git.claws-mail.org/?p=claws.git;a=commitdiff;h=d013b054b54997cd892863712c024379f86d2ea0
Merge: c2ff8a9 edb27a1
Author: Colin Leroy <colin@colino.net>
Date:   Fri Sep 12 08:13:02 2014 +0200

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

http://git.claws-mail.org/?p=claws.git;a=commitdiff;h=edb27a1a701506fab0d12bce823f59bf302e4f00
Author: Paul <paul@claws-mail.org>
Date:   Fri Sep 12 07:12:44 2014 +0100

    fix bug 3265, 'procmime.c: unbalanced flockfile() / funlockfile()'
    
    Patch by Timo Teräs