rem: memcpy(tmp, SRV_TCP_PREFIX, SRV_PREFIX_LEN); memcpy(tmp+SRV_PREFIX_LEN, name->s, name->len); tmp[SRV_PREFIX_LEN + name->len] = '\0';
add: memcpy(tmp, SRV_TCP_PREFIX, SRV_TCP_PREFIX_LEN); memcpy(tmp+SRV_TCP_PREFIX_LEN, name->s, name->len); tmp[SRV_TCP_PREFIX_LEN + name->len] = '\0';
context: struct hostent* sip_resolvehost(str* name, unsigned short* port, int proto){	struct hostent* he;	struct rdata* head;	struct rdata* l;	struct srv_rdata* srv;	struct ip_addr* ip;	static char tmp[MAX_DNS_NAME]; /* tmp. buff. for SRV lookups */	/* try SRV if no port specified (draft-ietf-sip-srv-06) */	if ((port)&&(*port==0)){		*port=(proto==PROTO_TLS)?SIPS_PORT:SIP_PORT; /* just in case we don't														find another */		if ((name->len+SRV_PREFIX_LEN+1)>MAX_DNS_NAME){			LOG(L_WARN, "WARNING: sip_resolvehost: domain name too long (%d),"						" unable to perform SRV lookup\n", name->len);		}else{			/* check if it's an ip address */			if ( ((ip=str2ip(name))!=0)#ifdef	USE_IPV6				  || ((ip=str2ip6(name))!=0)#endif				){				/* we are lucky, this is an ip address */				return ip_addr2he(name,ip);			}						switch(proto){				case PROTO_NONE: /* no proto specified, use udp */					goto skip_srv;				case PROTO_UDP:					memcpy(tmp, SRV_UDP_PREFIX, SRV_PREFIX_LEN);					memcpy(tmp+SRV_PREFIX_LEN, name->s, name->len);					tmp[SRV_PREFIX_LEN + name->len] = '\0';					break;				case PROTO_TCP:					memcpy(tmp, SRV_TCP_PREFIX, SRV_PREFIX_LEN);					memcpy(tmp+SRV_PREFIX_LEN, name->s, name->len);					tmp[SRV_PREFIX_LEN + name->len] = '\0';					break;				case PROTO_TLS:					memcpy(tmp, SRV_TLS_PREFIX, SRV_PREFIX_LEN);					memcpy(tmp+SRV_PREFIX_LEN, name->s, name->len);					tmp[SRV_PREFIX_LEN + name->len] = '\0';					break;				default:					LOG(L_CRIT, "BUG: sip_resolvehost: unknown proto %d\n",							proto);					return 0;			}			head=get_record(tmp, T_SRV);			for(l=head; l; l=l->next){				if (l->type!=T_SRV) continue; /*should never happen*/				srv=(struct srv_rdata*) l->rdata;				if (srv==0){					LOG(L_CRIT, "sip_resolvehost: BUG: null rdata\n");					free_rdata_list(head);					break;				}				he=resolvehost(srv->name);				if (he!=0){					/* we found it*/					DBG("sip_resolvehost: SRV(%s) = %s:%d\n",							tmp, srv->name, srv->port);					*port=srv->port;					free_rdata_list(head); /*clean up*/					return he;				}			}			DBG("sip_resolvehost: not SRV record found for %.*s," 					" trying 'normal' lookup...\n", name->len, name->s);		}	}skip_srv:	if (name->len >= MAX_DNS_NAME) {		LOG(L_ERR, "sip_resolvehost: domain name too long\n");		return 0;	}	memcpy(tmp, name->s, name->len);	tmp[name->len] = '\0';	he=resolvehost(tmp);	return he;}