[sr-dev] git:master:b4113035: pv: check for contact address in pv_get_hfl()

Daniel-Constantin Mierla miconda at gmail.com
Wed Oct 19 18:31:28 CEST 2022


Module: kamailio
Branch: master
Commit: b411303502282b2f4d32ad299ed5bcfd0852e902
URL: https://github.com/kamailio/kamailio/commit/b411303502282b2f4d32ad299ed5bcfd0852e902

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2022-10-19T18:31:18+02:00

pv: check for contact address in pv_get_hfl()

---

Modified: src/modules/pv/pv_core.c

---

Diff:  https://github.com/kamailio/kamailio/commit/b411303502282b2f4d32ad299ed5bcfd0852e902.diff
Patch: https://github.com/kamailio/kamailio/commit/b411303502282b2f4d32ad299ed5bcfd0852e902.patch

---

diff --git a/src/modules/pv/pv_core.c b/src/modules/pv/pv_core.c
index 27966dbdcd1..903389bf593 100644
--- a/src/modules/pv/pv_core.c
+++ b/src/modules/pv/pv_core.c
@@ -2449,11 +2449,16 @@ int pv_get_hfl(sip_msg_t *msg, pv_param_t *param, pv_value_t *res)
 		}
 		if(idx==0) {
 			cb = ((contact_body_t*)msg->contact->parsed)->contacts;
-			sval.s = cb->name.s;
-			sval.len = cb->len;
-			trim(&sval);
-			res->rs = sval;
-			return 0;
+			if(cb!=NULL) {
+				sval.s = cb->name.s;
+				sval.len = cb->len;
+				trim(&sval);
+				res->rs = sval;
+				return 0;
+			} else {
+				LM_DBG("no contact addresses\n");
+				return pv_get_null(msg, param, res);
+			}
 		}
 		n=0;
 		for(hf=msg->contact; hf!=NULL; hf=hf->next) {




More information about the sr-dev mailing list