#667: remote crash exploit in bencode parser

This commit is contained in:
Charles Kerr
2008-01-31 02:24:43 +00:00
parent 008ce2fcfe
commit df9bd1f713
7 changed files with 702 additions and 287 deletions
+19
View File
@@ -96,6 +96,14 @@ tr_ptrArrayNth( tr_ptrArray* t, int i )
return t->items[i];
}
void*
tr_ptrArrayBack( tr_ptrArray* t )
{
assert( t->n_items > 0 );
return tr_ptrArrayNth( t, t->n_items-1 );
}
int
tr_ptrArraySize( const tr_ptrArray * t )
{
@@ -140,6 +148,17 @@ tr_ptrArrayAppend( tr_ptrArray * t, void * ptr )
return tr_ptrArrayInsert( t, ptr, -1 );
}
void*
tr_ptrArrayPop( tr_ptrArray* t )
{
void * ret = NULL;
if( t->n_items )
ret = t->items[--t->n_items];
return ret;
}
void
tr_ptrArrayErase( tr_ptrArray * t, int begin, int end )
{