[sr-dev] git:master:5443db4d: dispatcher: safety checks for str fields

Daniel-Constantin Mierla miconda at gmail.com
Tue Jan 11 09:03:19 CET 2022


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2022-01-11T08:20:30+01:00

dispatcher: safety checks for str fields

---

Modified: src/modules/dispatcher/dispatch.c

---

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

---

diff --git a/src/modules/dispatcher/dispatch.c b/src/modules/dispatcher/dispatch.c
index 661b4a9533..26836433f1 100644
--- a/src/modules/dispatcher/dispatch.c
+++ b/src/modules/dispatcher/dispatch.c
@@ -1192,7 +1192,7 @@ unsigned int ds_get_hash(str *x, str *y)
 	if(!x && !y)
 		return 0;
 	h = 0;
-	if(x) {
+	if(x && x->s) {
 		p = x->s;
 		if(x->len >= 4) {
 			for(; p <= (x->s + x->len - 4); p += 4) {
@@ -1207,7 +1207,7 @@ unsigned int ds_get_hash(str *x, str *y)
 		}
 		h += v ^ (v >> 3);
 	}
-	if(y) {
+	if(y && y->s) {
 		p = y->s;
 		if(y->len >= 4) {
 			for(; p <= (y->s + y->len - 4); p += 4) {




More information about the sr-dev mailing list