Module: kamailio
Branch: master
Commit: cfc89db53c087382c29d809dc0bc56f7351af2d1
URL:
https://github.com/kamailio/kamailio/commit/cfc89db53c087382c29d809dc0bc56f…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2019-01-08T12:24:27+01:00
topos_redis: check the branch value to avoid using uninitialized fields
- GH #1784
---
Modified: src/modules/topos_redis/topos_redis_storage.c
---
Diff:
https://github.com/kamailio/kamailio/commit/cfc89db53c087382c29d809dc0bc56f…
Patch:
https://github.com/kamailio/kamailio/commit/cfc89db53c087382c29d809dc0bc56f…
---
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,