Bug 3265 - procmime.c: unbalanced flockfile() / funlockfile()
Summary: procmime.c: unbalanced flockfile() / funlockfile()
Status: RESOLVED FIXED
Alias: None
Product: Claws Mail (GTK 2)
Classification: Unclassified
Component: Other (show other bugs)
Version: 3.10.1
Hardware: PC Linux
: P3 normal
Assignee: users
URL:
Depends on:
Blocks:
 
Reported: 2014-09-05 12:23 UTC by Timo Teräs
Modified: 2014-09-12 08:16 UTC (History)
0 users

See Also:


Attachments
proposed fix (424 bytes, patch)
2014-09-05 12:23 UTC, Timo Teräs
no flags Details | Diff

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

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