Browse Source

rtpproxy: make sure we null terminate the copy of the string.

bug introduced at d00ceda2c04
Victor Seva 2 years ago
parent
commit
3c1700fb76
1 changed files with 2 additions and 1 deletions
  1. 2 1
      src/modules/rtpproxy/rtpproxy.c

+ 2 - 1
src/modules/rtpproxy/rtpproxy.c

@@ -1834,7 +1834,8 @@ static int rtpproxy_answer1_helper_f(struct sip_msg *msg, char *flags)
 
 	cp.s = ip_addr2a(&msg->rcv.dst_ip);
 	cp.len = strlen(cp.s);
-	memcpy(newip, cp.s, cp.len);
+	/* Copy, including teminating \0 */
+	memcpy(newip, cp.s, cp.len + 1);
 
 	return force_rtp_proxy(msg, flags, newip, 0, 0);
 }