From: Michael Jerris Date: Wed, 21 May 2008 23:12:38 +0000 (+0000) Subject: don't deref NULL. Found by Klockwork (www.klocwork.com) X-Git-Tag: v1.0.0~161 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9b2b3beed2da2a56133982d1f6ab99388b2dcc61;p=thirdparty%2Ffreeswitch.git don't deref NULL. Found by Klockwork (www.klocwork.com) git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8516 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- diff --git a/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c b/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c index 7b1cf2795a..487c9b1830 100644 --- a/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c +++ b/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c @@ -419,14 +419,17 @@ abyss_bool handler_hook(TSession * r) stream.write_function = http_stream_write; stream.raw_write_function = http_stream_raw_write; + if (!r || !r->uri) { + return FALSE; + } + if ((command = strstr(r->uri, "/api/"))) { command += 5; } else if ((command = strstr(r->uri, "/webapi/"))) { command += 8; html++; } else { - ret = FALSE; - goto end; + return FALSE; } if ((path_info = strchr(command, '/'))) { @@ -490,8 +493,7 @@ abyss_bool handler_hook(TSession * r) switch_event_add_header(stream.event, SWITCH_STACK_BOTTOM, "FreeSWITCH-Domain", "%s", fs_domain); if (path_info) switch_event_add_header(stream.event, SWITCH_STACK_BOTTOM, "HTTP-Path-Info", "%s", path_info); - if (r->uri) - switch_event_add_header(stream.event, SWITCH_STACK_BOTTOM, "HTTP-URI", "%s", r->uri); + switch_event_add_header(stream.event, SWITCH_STACK_BOTTOM, "HTTP-URI", "%s", r->uri); if (r->query) switch_event_add_header(stream.event, SWITCH_STACK_BOTTOM, "HTTP-QUERY", "%s", r->query); if (r->host)