[sr-dev] git:master:c259eb64: wrong printf format

Henning Westerholt hw at gilawa.com
Tue Apr 19 11:45:33 CEST 2022


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

Author: liviu-rolo <82887358+liviu-rolo at users.noreply.github.com>
Committer: Henning Westerholt <hw at gilawa.com>
Date: 2022-04-19T11:45:27+02:00

wrong printf format

"%*.s"  used instead of "%.*s": "The result is padded with space characters" (https://en.cppreference.com/w/cpp/io/c/fprintf)
Probably harmless (but still wrong) if the string ends with '\0'.

---

Modified: src/modules/htable/ht_db.c

---

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

---

diff --git a/src/modules/htable/ht_db.c b/src/modules/htable/ht_db.c
index cbce085f6c..bbcba99913 100644
--- a/src/modules/htable/ht_db.c
+++ b/src/modules/htable/ht_db.c
@@ -495,7 +495,7 @@ int ht_db_load_table(ht_t *ht, str *dbtable, int mode)
 				if (ht->htexpire > 0 && expires.n > 0) {
 					expires.n -= now;
 					if(ht_set_cell_expire(ht, &hname, 0, &expires)) {
-						LM_ERR("error setting expires to hash entry [%*.s]\n", hname.len, hname.s);
+						LM_ERR("error setting expires to hash entry [%.*s]\n", hname.len, hname.s);
 						goto error;
 					}
 				}




More information about the sr-dev mailing list