From ecfab318ed1c95119aaa91b631db9da87c686f4f Mon Sep 17 00:00:00 2001 From: Jordan Lee Date: Wed, 15 Feb 2012 01:44:21 +0000 Subject: [PATCH] (trunk libT) fix potential NULL pointer dereference in rpc-server.c's crude mime multipart parser --- libtransmission/rpc-server.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libtransmission/rpc-server.c b/libtransmission/rpc-server.c index c8946107b..0e913b2b7 100644 --- a/libtransmission/rpc-server.c +++ b/libtransmission/rpc-server.c @@ -160,7 +160,7 @@ extract_parts_from_multipart( const struct evkeyvalq * headers, size_t inlen = evbuffer_get_length( body ); const char * boundary_key = "boundary="; - const char * boundary_key_begin = strstr( content_type, boundary_key ); + const char * boundary_key_begin = content_type ? strstr( content_type, boundary_key ) : NULL; const char * boundary_val = boundary_key_begin ? boundary_key_begin + strlen( boundary_key ) : "arglebargle"; char * boundary = tr_strdup_printf( "--%s", boundary_val ); const size_t boundary_len = strlen( boundary );