(trunk libT) #4284 "crash via webfrontend or transmission-remote" -- use patch from jerwied

This commit is contained in:
Jordan Lee 2011-05-27 23:28:40 +00:00
parent dcf814a481
commit d6e39e4d2f
1 changed files with 2 additions and 3 deletions

View File

@ -1265,7 +1265,7 @@ jsonIndent( struct jsonWalk * data )
static void
jsonChildFunc( struct jsonWalk * data )
{
if( data->parents )
if( data->parents && data->parents->data )
{
struct ParentState * parentState = data->parents->data;
@ -1372,9 +1372,8 @@ jsonStringFunc( const tr_benc * val, void * vdata )
struct jsonWalk * data = vdata;
const unsigned char * it = (const unsigned char *) getStr(val);
const unsigned char * end = it + val->val.s.len;
const int safeguard = 512; /* arbitrary margin for escapes and unicode */
evbuffer_reserve_space( data->out, val->val.s.len+safeguard, vec, 1 );
evbuffer_reserve_space( data->out, val->val.s.len * 4, vec, 1 );
out = vec[0].iov_base;
outend = out + vec[0].iov_len;