浏览代码

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

bug introduced at d00ceda2c04
Victor Seva 2 年之前
父节点
当前提交
3c1700fb76
共有 1 个文件被更改,包括 2 次插入1 次删除
  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);
 }