From f9789d46aac59f1ff28bc532d8589c1661fa7c4b Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Tue, 20 Dec 2011 17:42:17 +0100 Subject: NULL-checking in rfc822_get_header() and OAuth response handling. --- lib/misc.c | 5 ++++- lib/oauth2.c | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/misc.c b/lib/misc.c index 442f8f19..a7065757 100644 --- a/lib/misc.c +++ b/lib/misc.c @@ -734,6 +734,9 @@ char *get_rfc822_header( char *text, char *header, int len ) int hlen = strlen( header ), i; char *ret; + if( text == NULL ) + return NULL; + if( len == 0 ) len = strlen( text ); @@ -778,5 +781,5 @@ char *get_rfc822_header( char *text, char *header, int len ) } } - return( NULL ); + return NULL; } diff --git a/lib/oauth2.c b/lib/oauth2.c index 4a9d256c..0348d0d0 100644 --- a/lib/oauth2.c +++ b/lib/oauth2.c @@ -112,7 +112,7 @@ static void oauth2_access_token_done( struct http_request *req ) if( req->status_code != 200 ) { } - else if( strstr( content_type, "application/json" ) ) + else if( content_type && strstr( content_type, "application/json" ) ) { atoken = oauth2_json_dumb_get( req->reply_body, "access_token" ); rtoken = oauth2_json_dumb_get( req->reply_body, "refresh_token" ); -- cgit v1.2.3