Browse code

Update to the sr calling convetion of parse_phostport

We need to create a zero-terminated copy of the input string using
as_asciiz before passing the string to parse_phostport

Jan Janak authored on 17/03/2009 18:23:54
Showing 1 changed files
... ...
@@ -966,12 +966,18 @@ dlg_t* build_dlg_t(subs_t* subs)
966 966
 	if (subs->sockinfo_str.len) {
967 967
 		int port, proto;
968 968
         str host;
969
-		if (parse_phostport (
970
-				subs->sockinfo_str.s,subs->sockinfo_str.len,&host.s,
969
+		char* tmp;
970
+		if ((tmp = as_asciiz(&subs->sockinfo_str)) == NULL) {
971
+			LM_ERR("no pkg memory left\n");
972
+			goto error;
973
+		}
974
+		if (parse_phostport (tmp,&host.s,
971 975
 				&host.len,&port, &proto )) {
972 976
 			LM_ERR("bad sockinfo string\n");
977
+			pkg_free(tmp);
973 978
 			goto error;
974 979
 		}
980
+		pkg_free(tmp);
975 981
 		td->send_sock = grep_sock_info (
976 982
 			&host, (unsigned short) port, (unsigned short) proto);
977 983
 	}