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

View file

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