Module: kamailio
Branch: master
Commit: ffac3c32fcff789bc4712f1b54f052445d33e089
URL:
https://github.com/kamailio/kamailio/commit/ffac3c32fcff789bc4712f1b54f0524…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2017-09-20T13:40:22+02:00
topos_redis: safer size for snprintf buf to allow space for numbers
---
Modified: src/modules/topos_redis/topos_redis_storage.c
---
Diff:
https://github.com/kamailio/kamailio/commit/ffac3c32fcff789bc4712f1b54f0524…
Patch:
https://github.com/kamailio/kamailio/commit/ffac3c32fcff789bc4712f1b54f0524…
---
diff --git a/src/modules/topos_redis/topos_redis_storage.c
b/src/modules/topos_redis/topos_redis_storage.c
index 6d2cf7dcf3..7c5313dee9 100644
--- a/src/modules/topos_redis/topos_redis_storage.c
+++ b/src/modules/topos_redis/topos_redis_storage.c
@@ -327,12 +327,12 @@ int tps_redis_insert_invite_branch(tps_data_t *td)
argc = 0;
rp = _tps_redis_cbuf;
- rkey.len = snprintf(rp, TPS_REDIS_DATA_SIZE,
+ rkey.len = snprintf(rp, TPS_REDIS_DATA_SIZE-128,
"%.*sINVITE:%.*s:%.*s",
_tps_redis_bprefix.len, _tps_redis_bprefix.s,
td->a_callid.len, td->a_callid.s,
td->b_tag.len, td->b_tag.s);
- if(rkey.len<0 || rkey.len>=TPS_REDIS_DATA_SIZE) {
+ if(rkey.len<0 || rkey.len>=TPS_REDIS_DATA_SIZE-128) {
LM_ERR("error or insufficient buffer size: %d\n", rkey.len);
return -1;
}