瀏覽代碼

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

Broken in d00ceda2c04.
Maksym Sobolyev 2 年之前
父節點
當前提交
2750e48b54
共有 1 個文件被更改,包括 2 次插入1 次删除
  1. 2 1
      src/modules/rtpproxy/rtpproxy.c

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

@@ -1698,7 +1698,8 @@ static int rtpproxy_manage(struct sip_msg *msg, char *flags, char *ip)
 	if(ip == NULL) {
 		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);
 	}
 
 	if(msg->msg_flags & FL_SDP_BODY)