rem: safe_len=safe_str(cur, tok, *len - n - 1); if (safe_len==0) { LOG(L_ERR, "XLOG: xl_print_log: buffer safe-maker overflow ...\n"); break; } n += safe_len; cur +=safe_len;
add: else goto overflow;
context: int xl_print_log(struct sip_msg* msg, xl_elog_p log, char *buf, int *len){	int n;	str tok;	xl_elog_p it;	int safe_len;	char *cur;		if(msg==NULL || log==NULL || buf==NULL || len==NULL)		return -1;	if(*len <= 0)		return -1;	*buf = '\0';	cur = buf;	n = 0;	for (it=log; it; it=it->next) 	{		/* put the text */		if(it->text.s && it->text.len>0) {			if(n+it->text.len+1 >= *len) {				LOG(L_ERR, "XLOG: xl_print_log: buffer text overflow ...\n");				break;			}			memcpy(cur, it->text.s, it->text.len);			n += it->text.len;			cur+=it->text.len;		}		/* put the value of the specifier; tok includes pointers to received SIP		 * mesage 		 */		if(it->itf && !((*it->itf)(msg, &tok))) {			if(n+tok.len + 1 >= *len) {				LOG(L_ERR, "XLOG: xl_print_log: buffer specifier overflow ...\n");				break;			}			/* escape %% to make call to syslog safe; parameters:			 * 1) destination buffer, 2) source buffer, 3) available length			 * output: length (0 on overflow)			 */			safe_len=safe_str(cur, tok, *len - n - 1);			if (safe_len==0) {				LOG(L_ERR, "XLOG: xl_print_log: buffer safe-maker overflow ...\n");				break;			}			n += safe_len;			cur +=safe_len;		}	}		DBG("XLOG: xl_print_log: final buffer length %d\n", n);	*len = n;	*buf=0;	return 0;}