Browse code

core: compute the len for dns srv name

- fixes dns srv for cache, reported by Rob Eijgenraam, FS#426

Daniel-Constantin Mierla authored on 30/04/2014 19:46:55
Showing 1 changed files
... ...
@@ -2656,7 +2656,6 @@ struct hostent* dns_srv_sip_resolvehost(str* name, unsigned short* port,
2656 2656
 	struct hostent* he;
2657 2657
 	struct ip_addr* ip;
2658 2658
 	static char tmp[MAX_DNS_NAME]; /* tmp. buff. for SRV lookups */
2659
-	int len;
2660 2659
 	str srv_name;
2661 2660
 	char srv_proto;
2662 2661
 
... ...
@@ -2664,7 +2663,6 @@ struct hostent* dns_srv_sip_resolvehost(str* name, unsigned short* port,
2664 2664
 		/* not init or off => use normal, non-cached version */
2665 2665
 		return _sip_resolvehost(name, port, proto);
2666 2666
 	}
2667
-	len=0;
2668 2667
 	if (proto){ /* makes sure we have a protocol set*/
2669 2668
 		if (*proto==0)
2670 2669
 			*proto=srv_proto=PROTO_UDP; /* default */
... ...
@@ -2708,7 +2706,7 @@ struct hostent* dns_srv_sip_resolvehost(str* name, unsigned short* port,
2708 2708
 			}
2709 2709
 
2710 2710
 			srv_name.s=tmp;
2711
-			srv_name.len=len;
2711
+			srv_name.len=strlen(tmp);
2712 2712
 			if ((he=dns_srv_get_he(&srv_name, port, dns_flags))!=0)
2713 2713
 				return he;
2714 2714
 		}