Issue #373 - Avoid a null added to output.

This bug was first openned in 2009 by Christophe Chenon, as bug sf905 but
the patch provided then never made it into the source.

Now appears fixed, 7 years later!
This commit is contained in:
Geoff McLane 2016-02-15 12:57:22 +01:00
parent a4f425546f
commit 9cf97d536b
2 changed files with 18 additions and 7 deletions

View file

@ -352,6 +352,7 @@ uint EntityCode( ctmbstr name, uint versions )
Bool TY_(EntityInfo)( ctmbstr name, Bool isXml, uint* code, uint* versions ) Bool TY_(EntityInfo)( ctmbstr name, Bool isXml, uint* code, uint* versions )
{ {
const entity* np; const entity* np;
int res;
assert( name && name[0] == '&' ); assert( name && name[0] == '&' );
assert( code != NULL ); assert( code != NULL );
assert( versions != NULL ); assert( versions != NULL );
@ -363,14 +364,24 @@ Bool TY_(EntityInfo)( ctmbstr name, Bool isXml, uint* code, uint* versions )
/* 'x' prefix denotes hexadecimal number format */ /* 'x' prefix denotes hexadecimal number format */
if ( name[2] == 'x' || (!isXml && name[2] == 'X') ) if ( name[2] == 'x' || (!isXml && name[2] == 'X') )
sscanf( name+3, "%x", &c ); res = sscanf( name+3, "%x", &c );
else else
sscanf( name+2, "%u", &c ); res = sscanf( name+2, "%u", &c );
/* Issue #373 - Null Char in XML result doc - sf905 2009 */
if ( res == 1 )
{
*code = c; *code = c;
*versions = VERS_ALL; *versions = VERS_ALL;
return yes; return yes;
} }
else
{
*code = 0;
*versions = ( isXml ? VERS_XML : VERS_PROPRIETARY );
return no;
}
}
/* Named entity: name ="&" followed by a name */ /* Named entity: name ="&" followed by a name */
if ( NULL != (np = entitiesLookup(name+1)) ) if ( NULL != (np = entitiesLookup(name+1)) )

View file

@ -1,2 +1,2 @@
5.1.36 5.1.36issue-373
2016.02.01 2016.02.15