Module: kamailio
Branch: 5.1
Commit: 74b8fbf0fc820d48a0203b81d2cd41f6e84dc5c5
URL:
https://github.com/kamailio/kamailio/commit/74b8fbf0fc820d48a0203b81d2cd41f…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2019-01-08T15:18:22+01:00
topos_redis: check the branch value to avoid using uninitialized fields
- GH #1784
(cherry picked from commit cfc89db53c087382c29d809dc0bc56f7351af2d1)
(cherry picked from commit 7c551812960dd1cfc2901a7a46bbf3010df47cd7)
---
Modified: src/modules/topos_redis/topos_redis_storage.c
---
Diff:
https://github.com/kamailio/kamailio/commit/74b8fbf0fc820d48a0203b81d2cd41f…
Patch:
https://github.com/kamailio/kamailio/commit/74b8fbf0fc820d48a0203b81d2cd41f…
---
diff --git a/src/modules/topos_redis/topos_redis_storage.c
b/src/modules/topos_redis/topos_redis_storage.c
index 22279e0138..a72dd7c266 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,