Browse code

rr: conditions adjustmets for append from tag in record route preset

Daniel-Constantin Mierla authored on 08/04/2021 11:19:17
Showing 2 changed files
... ...
@@ -570,7 +570,7 @@ int record_route_preset(struct sip_msg* _m, str* _data)
570 570
 		hdr.len += user.len + 1; /* @ */
571 571
 	hdr.len += _data->len;
572 572
 
573
-	if (append_fromtag && from->tag_value.len) {
573
+	if (append_fromtag && from && from->tag_value.len) {
574 574
 		hdr.len += RR_FROMTAG_LEN + from->tag_value.len;
575 575
 	}
576 576
 
... ...
@@ -612,7 +612,7 @@ int record_route_preset(struct sip_msg* _m, str* _data)
612 612
 	memcpy(p, _data->s, _data->len);
613 613
 	p += _data->len;
614 614
 
615
-	if (append_fromtag && from->tag_value.len) {
615
+	if (append_fromtag && from && from->tag_value.len) {
616 616
 		memcpy(p, RR_FROMTAG, RR_FROMTAG_LEN);
617 617
 		p += RR_FROMTAG_LEN;
618 618
 		memcpy(p, from->tag_value.s, from->tag_value.len);
... ...
@@ -253,7 +253,6 @@ static int direction_fixup(void** param, int param_no)
253 253
 		return E_CFG;
254 254
 	}
255 255
 	if (param_no==1) {
256
-		n = 0;
257 256
 		s = (char*) *param;
258 257
 		if ( strcasecmp(s,"downstream")==0 ) {
259 258
 			n = RR_FLOW_DOWNSTREAM;