[sr-dev] git:master:823bad5f: uid_uri_db: safer check for accessing to header

Daniel-Constantin Mierla miconda at gmail.com
Mon Jul 24 08:27:49 CEST 2017


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2017-07-24T08:22:24+02:00

uid_uri_db: safer check for accessing to header

---

Modified: src/modules/uid_uri_db/uid_uri_db_mod.c

---

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

---

diff --git a/src/modules/uid_uri_db/uid_uri_db_mod.c b/src/modules/uid_uri_db/uid_uri_db_mod.c
index 4e5771f493..dba6454b81 100644
--- a/src/modules/uid_uri_db/uid_uri_db_mod.c
+++ b/src/modules/uid_uri_db/uid_uri_db_mod.c
@@ -238,14 +238,14 @@ static int lookup_uid(struct sip_msg* msg, long id, int store)
 	} else if (id == USE_TO) {
 		get_to_did(&did, msg);
 		if (!msg->to) {
-			if (parse_headers( msg, HDR_TO_F, 0 )==-1) {
+			if (parse_headers(msg, HDR_TO_F, 0)==-1 || !msg->to) {
 				ERR("unable to parse To header\n");
 				return -1;
 			}
 		}
 		to = get_to(msg);
 		if (!to) {
-			LOG(L_ERR, "uri_db:lookup_uid: Unable to get To username\n");
+			LOG(L_ERR, "uri_db:lookup_uid: Unable to get To body\n");
 			return -1;
 		}
 		if (parse_uri(to->uri.s, to->uri.len, &puri) < 0) {




More information about the sr-dev mailing list