Fix static analysis issues

Fix various static analysis issues.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
diff --git a/ap.c b/ap.c
index 4c9c05b..1ee6d1c 100644
--- a/ap.c
+++ b/ap.c
@@ -6960,7 +6960,7 @@
 	}
 	snprintf(temp, sizeof(temp), " %02x:%02x:%02x:%02x:%02x:%02x",
 		 mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
-	strncat(buf, temp, buf_size - strlen(temp) - 1);
+	strncat(buf, temp, buf_size - strlen(buf) - 1);
 	return 0;
 }
 
diff --git a/miracast.c b/miracast.c
index 6d41f81..bdb38cd 100644
--- a/miracast.c
+++ b/miracast.c
@@ -452,11 +452,8 @@
 						 1-P-Sink, 2-Secondary Sink */
 					 char *); /* for returning session ID */
 
-	if (!dut) {
-		sigma_dut_print(dut, DUT_MSG_ERROR,
-				"Bail out, RTSP thread has invalid parameters");
+	if (!dut)
 		goto EXIT;
-	}
 
 	miracast_load(dut);
 
@@ -643,11 +640,9 @@
 						1-P-Sink, 2-Secondary Sink */
 					 char *); /* for returning session ID */
 
-	if (!dut) {
-		sigma_dut_print(dut, DUT_MSG_ERROR,
-				"Bail out, RTSP thread has invalid parameters");
+	if (!dut)
 		goto THR_EXIT;
-	}
+
 	stop_dhcp(dut, wfd_ifname, 1);
 	/* For auto-GO, start the DHCP server and wait for 5 seconds */
 	start_dhcp(dut, wfd_ifname, 1);
@@ -782,7 +777,10 @@
 		return -1;
 	sigma_dut_print(dut, DUT_MSG_DEBUG, "miracast_dev_send_frame 1");
 	miracast_generate_string_cmd(cmd, string_cmd, sizeof(string_cmd));
-	if (strcasecmp(frame_name, "RTSP") != 0)
+	if (frame_name && strcasecmp(frame_name, "RTSP") != 0)
+		return 0;
+
+	if (!rtsp_msg_type)
 		return 0;
 
 	if (strcasecmp(rtsp_msg_type, "PAUSE") == 0 ||
diff --git a/sta.c b/sta.c
index 970307f..e2ca2d6 100644
--- a/sta.c
+++ b/sta.c
@@ -3085,12 +3085,9 @@
 	const char *val;
 
 	val = get_param(cmd, "Program");
-	if (val && strcasecmp(val, "HS2-R2") == 0) {
-		if (intf == NULL)
-			return -1;
+	if (val && strcasecmp(val, "HS2-R2") == 0)
 		return cmd_sta_preset_testparameters_hs2_r2(dut, conn, intf,
 							    cmd);
-	}
 
 	if (val && strcasecmp(val, "LOC") == 0)
 		return loc_cmd_sta_preset_testparameters(dut, conn, cmd);