[Freeswitch-svn] [commit] r8516 - freeswitch/trunk/src/mod/xml_int/mod_xml_rpc

Freeswitch SVN mikej at freeswitch.org
Wed May 21 19:12:39 EDT 2008


Author: mikej
Date: Wed May 21 19:12:38 2008
New Revision: 8516

Modified:
   freeswitch/trunk/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c

Log:
don't deref NULL. Found by Klockwork (www.klocwork.com)

Modified: freeswitch/trunk/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c
==============================================================================
--- freeswitch/trunk/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c	(original)
+++ freeswitch/trunk/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c	Wed May 21 19:12:38 2008
@@ -419,14 +419,17 @@
 	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 @@
 			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)



More information about the Freeswitch-svn mailing list