mirror of
https://github.com/transmission/transmission
synced 2025-02-12 01:14:54 +00:00
Fix a parsing bug which could be triggered by a truncated xml file.
This commit is contained in:
parent
9d570c03db
commit
9aaa36a431
1 changed files with 3 additions and 6 deletions
|
@ -161,6 +161,7 @@ tr_xmlSkipTag( const char * begin, const char * end )
|
|||
}
|
||||
else
|
||||
{
|
||||
CHECKNULL( begin, end, NULL );
|
||||
overtag( begin, end, &begin );
|
||||
return begin;
|
||||
}
|
||||
|
@ -258,6 +259,7 @@ skipall( const char * begin, const char * end, const char ** afterpos )
|
|||
static int
|
||||
nexttag( const char * begin, const char * end, const char ** tagpos )
|
||||
{
|
||||
*tagpos = NULL;
|
||||
CHECKNULL( begin, end, 0 );
|
||||
|
||||
while( end > begin )
|
||||
|
@ -271,15 +273,10 @@ nexttag( const char * begin, const char * end, const char ** tagpos )
|
|||
{
|
||||
*tagpos = begin;
|
||||
begin++;
|
||||
if( end > begin )
|
||||
{
|
||||
return ( TAGCLOSE != *begin );
|
||||
}
|
||||
break;
|
||||
return ( end > begin && TAGCLOSE != *begin );
|
||||
}
|
||||
}
|
||||
|
||||
*tagpos = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue