add: res->s[len]=0;
context: str* subst_str(char *input, struct sip_msg* msg, struct subst_expr* se){	str* res;	struct replace_lst *lst;	struct replace_lst* l;	int len;	int size;	char* p;	char* dest;	char* end;			/* compute the len */	len=strlen(input);	end=input+len;	lst=subst_run(se, input, msg);	if (lst==0){		DBG("subst_str: no match\n");		return 0;	}	for (l=lst; l; l=l->next)		len+=(int)(l->rpl.len)-l->size;	res=pkg_malloc(sizeof(str));	if (res==0){		LOG(L_ERR, "ERROR: subst_str: mem. allocation error\n");		goto error;	}	res->s=pkg_malloc(len+1); /* space for null termination */	res->s[len]=0;	if (res->s==0){		LOG(L_ERR, "ERROR: subst_str: mem. allocation error (res->s)\n");		goto error;	}	res->len=len;		/* replace */	dest=res->s;	p=input;	for(l=lst; l; l=l->next){		size=l->offset+input-p;		memcpy(dest, p, size); /* copy till offset */		p+=size + l->size; /* skip l->size bytes */		dest+=size;		if (l->rpl.len){			memcpy(dest, l->rpl.s, l->rpl.len);			dest+=l->rpl.len;		}	}	memcpy(dest, p, end-p);	if(lst) replace_lst_free(lst);	return res;error:	if (lst) replace_lst_free(lst);	if (res){		if (res->s) pkg_free(res->s);		pkg_free(res);	}	return 0;}