Pārlūkot izejas kodu

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 gadi atpakaļ
vecāks
revīzija
6e1af068c9
1 mainītis faili ar 10 papildinājumiem un 3 dzēšanām
  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;