[sr-dev] git:master:ffac3c32: topos_redis: safer size for snprintf buf to allow space for numbers

Daniel-Constantin Mierla miconda at gmail.com
Wed Sep 20 13:41:15 CEST 2017


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at 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/ffac3c32fcff789bc4712f1b54f052445d33e089.diff
Patch: https://github.com/kamailio/kamailio/commit/ffac3c32fcff789bc4712f1b54f052445d33e089.patch

---

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;
 	}




More information about the sr-dev mailing list