瀏覽代碼

core/sdp: restore setting of IP address type

- refactoring of extract_mediaip() skipped setting IPv4/IPv6 type in sdp
  structure
- reported by Jason Penton
Daniel-Constantin Mierla 14 年之前
父節點
當前提交
6e1af068c9
共有 1 個文件被更改,包括 10 次插入3 次删除
  1. 10 3
      parser/sdp/sdp_helpr_funcs.c

+ 10 - 3
parser/sdp/sdp_helpr_funcs.c

@@ -451,9 +451,16 @@ int extract_mediaip(str *body, str *mediaip, int *pf, char *line)
 		LM_ERR("invalid content for `%s' line\n",line);
 		return -1;
 	}
-	if(cp[3]!='4' && cp[3]!='6') {
-		LM_ERR("invalid addrtype IPx for `%s' line\n",line);
-		return -1;
+	switch(cp[3]) {
+		case '4':
+			*pf = AF_INET;
+		break;
+		case '6':
+			*pf = AF_INET6;
+		break;
+		default:
+			LM_ERR("invalid addrtype IPx for `%s' line\n",line);
+			return -1;
 	}
 	cp += 5;