Bug 57080 - conn-avatar : segfault - too small base64 string allocation
Summary: conn-avatar : segfault - too small base64 string allocation
Status: RESOLVED FIXED
Alias: None
Product: Telepathy
Classification: Unclassified
Component: gabble (show other bugs)
Version: git master
Hardware: Other All
: medium major
Assignee: Telepathy bugs list
QA Contact: Telepathy bugs list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-11-13 18:01 UTC by Alban Browaeys
Modified: 2012-11-14 15:54 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
fix base64 allocated length (1.14 KB, patch)
2012-11-13 18:01 UTC, Alban Browaeys
Details | Splinter Review

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.