Module: kamailio
Branch: master
Commit: 4be1c60bb67d191f8a2715253a7cbcb2ea412d85
URL:
https://github.com/kamailio/kamailio/commit/4be1c60bb67d191f8a2715253a7cbcb…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2018-09-20T16:32:09+02:00
dispatcher: use memcpy() instead of strncpy()
- avoid gcc 8.2 warning: âstrncpyâ output truncated before terminating nul
copying 4 bytes from a string of the same length [-Wstringop-truncation]
---
Modified: src/modules/dispatcher/dispatch.c
---
Diff:
https://github.com/kamailio/kamailio/commit/4be1c60bb67d191f8a2715253a7cbcb…
Patch:
https://github.com/kamailio/kamailio/commit/4be1c60bb67d191f8a2715253a7cbcb…
---
diff --git a/src/modules/dispatcher/dispatch.c b/src/modules/dispatcher/dispatch.c
index 0422cd6b20..20077f1506 100644
--- a/src/modules/dispatcher/dispatch.c
+++ b/src/modules/dispatcher/dispatch.c
@@ -330,8 +330,8 @@ ds_dest_t *pack_dest(str iuri, int flags, int priority, str *attrs)
/* check uri */
if(parse_uri(uri.s, uri.len, &puri) != 0) {
if(iuri.len>4 && strncmp(iuri.s, "sip:", 4)!=0 &&
iuri.len<500) {
- strncpy(ub, "sip:", 4);
- strncpy(ub+4, iuri.s, iuri.len);
+ memcpy(ub, "sip:", 4);
+ memcpy(ub+4, iuri.s, iuri.len);
ub[iuri.len+4] = '\0';
uri.s = ub;
uri.len = iuri.len+4;