[sr-dev] git:5.2:7c551812: topos_redis: check the branch value to avoid using uninitialized fields

Daniel-Constantin Mierla miconda at gmail.com
Tue Jan 8 15:17:57 CET 2019


Module: kamailio
Branch: 5.2
Commit: 7c551812960dd1cfc2901a7a46bbf3010df47cd7
URL: https://github.com/kamailio/kamailio/commit/7c551812960dd1cfc2901a7a46bbf3010df47cd7

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2019-01-08T15:17:28+01:00

topos_redis: check the branch value to avoid using uninitialized fields

- GH #1784

(cherry picked from commit cfc89db53c087382c29d809dc0bc56f7351af2d1)

---

Modified: src/modules/topos_redis/topos_redis_storage.c

---

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

---

diff --git a/src/modules/topos_redis/topos_redis_storage.c b/src/modules/topos_redis/topos_redis_storage.c
index 2f78d21dce..ed8a7616dc 100644
--- a/src/modules/topos_redis/topos_redis_storage.c
+++ b/src/modules/topos_redis/topos_redis_storage.c
@@ -737,8 +737,13 @@ int tps_redis_load_branch(sip_msg_t *msg, tps_data_t *md, tps_data_t *sd,
 			LM_ERR("failed to load the INVITE branch value\n");
 			return -1;
 		}
+		memset(&id, 0, sizeof(tps_data_t));
 		xvbranch1 = &id.x_vbranch1;
 	}
+	if(xvbranch1->len<=0 || xvbranch1->s==NULL) {
+		LM_DBG("branch value not found (mode: %u)\n", mode);
+		return 1;
+	}
 	rp = _tps_redis_cbuf;
 	memcpy(rp, _tps_redis_bprefix.s, _tps_redis_bprefix.len);
 	memcpy(rp + _tps_redis_bprefix.len,




More information about the sr-dev mailing list