Bug 73089 - [patch] libxklavier returns pointer to static memory where dynamic is expected
Summary: [patch] libxklavier returns pointer to static memory where dynamic is expected
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-gnome (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-10-24 19:10 UTC by Oleg Sharoiko
Modified: 2004-10-25 14:16 UTC (History)
1 user (show)

See Also:


Attachments
libxklavier.diff (584 bytes, patch)
2004-10-25 11:44 UTC, Oleg Sharoiko
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Oleg Sharoiko 2004-10-24 19:10:22 UTC
	Function _XklLocaleFromUtf8() is used internaly by libxklavier.
This function usually returns pointer to dynamicly allocated memory.
But in some rare cases it may reach the last line which is

return converted;

where converted is

static char converted[XKL_MAX_CI_DESC_LENGTH];

This may result in a following error:

gnome-keyboard-properties in free(): error: junk pointer, too high to make sense

Fix: 

It looks like changing

return converted;

to

return strdup(converted);

would be enough.

I've submitted the PR to libxklavier SF page. Not sure though if they check it often enough. http://sourceforge.net/tracker/index.php?func=detail&aid=1052700&group_id=319&atid=300319
How-To-Repeat: 	It looks like last line of _XklLocaleFromUtf8 is reached only in some rare cases depending on some external condtions (files or something else). Unfortunately I can not provide exact instruction on how to repeat this error. But I suppose looking at _XklLocaleFromUtf8 code is enough to see this bug, as _XklLocaleFromUtf8 everywhere but on the last line returns results of strdup.
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2004-10-24 23:39:09 UTC
Responsible Changed
From-To: freebsd-ports-bugs->gnome

Over to maintainer(s).
Comment 2 Oleg Sharoiko 2004-10-25 11:44:16 UTC
It looks like the link is broken.
I'm attaching a patch with this mail.

-- 
Oleg Sharoiko.
Software and Network Engineer
Computer Center of Rostov State University.
Comment 3 Alexander Nedotsukov freebsd_committer 2004-10-25 14:14:33 UTC
State Changed
From-To: open->closed

Committed, thanks!