[Pkg-fonts-devel] Bug#590844: A fix
Theppitak Karoonboonyanan
thep at debian.org
Thu Jul 29 15:36:07 UTC 2010
package fontforge
tags 590844 + patch
thanks
The problem is at GFileGetAbsoluteName() in gutils/fsys.c, where strcpy() is
used to move strings between overlapping memory:
---8<---
/* Normalize out any .. */
spt = rpt = buffer;
while ( *spt!='\0' ) {
if ( *spt=='/' ) ++spt;
for ( pt = spt; *pt!='\0' && *pt!='/'; ++pt );
if ( pt==spt ) /* Found // in a path spec, reduce to / (we've*/
--> strcpy(spt,pt); /* skipped past the :// of the machine name) */
else if ( pt==spt+1 && spt[0]=='.' ) /* Noop */
--> strcpy(spt,pt);
else if ( pt==spt+2 && spt[0]=='.' && spt[1]=='.' ) {
for ( bpt=spt-2 ; bpt>rpt && *bpt!='/'; --bpt );
if ( bpt>=rpt && *bpt=='/' ) {
--> strcpy(bpt,pt);
spt = bpt;
} else {
rpt = pt;
spt = pt;
}
} else
spt = pt;
}
---8<---
I've verified this by inserting a printf to dump the result, and it resolve my
command line argument '../../tlwg/TlwgMono-BoldOblique.sfd' as
'/path/to/the/common/root/tlon/TlwgMono-BoldOblique.sfd'. Note that 'tlwg' is
overwritten and becomes 'tlon'.
Using memmove() instead fixes this. Proposed patch is attached.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 030_fix_abs_path_calc.diff
Type: text/x-diff
Size: 953 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-fonts-devel/attachments/20100729/0af6bac1/attachment.diff>
More information about the Pkg-fonts-devel
mailing list