Bug 57080

Summary: conn-avatar : segfault - too small base64 string allocation
Product: Telepathy Reporter: Alban Browaeys <prahal>
Component: gabbleAssignee: Telepathy bugs list <telepathy-bugs>
Status: RESOLVED FIXED QA Contact: Telepathy bugs list <telepathy-bugs>
Severity: major    
Priority: medium    
Version: git master   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: fix base64 allocated length

Description Alban Browaeys 2012-11-13 18:01:18 UTC
Created attachment 70014 [details] [review]
fix base64 allocated length

As per g_base64 documentation the minimum size is :
avatar->len / 3 + 1) *4 + 4)
and if line breaks are enabled:
+  ((avatar->len / 3 + 1) * 4 + 4) / 72 + 1

Currently in gdb I see outlen 3551 with base64 allocated with around 3501 bytes.
This comes from the use of :
(avatar->len / 3 + 1) * 4 + 1
as length to allocate to the base64 string.
Comment 1 Will Thompson 2012-11-14 15:54:41 UTC
Merged, and I've added a test case with a big enough avatar to make sure the line wrapping is exercised. Thanks for catching this so quickly before it made it into a release!

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.