[sr-dev] git:master:93ff141b: ims_registrar_scscf: use memcpy() instead of strncpy()

Victor Seva linuxmaniac at torreviejawireless.org
Fri Sep 28 14:42:51 CEST 2018


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

Author: Victor Seva <linuxmaniac at torreviejawireless.org>
Committer: Victor Seva <linuxmaniac at torreviejawireless.org>
Date: 2018-09-28T14:42:44+02:00

ims_registrar_scscf: use memcpy() instead of strncpy()

> common.c: In function 'extract_aor':
> common.c:88:2: warning: 'strncpy' output truncated before terminating nul copying 4 bytes from a string of the same length [-Wstringop-truncation]
>   strncpy(_a->s, "sip:", 4);
>   ^~~~~~~~~~~~~~~~~~~~~~~~~

---

Modified: src/modules/ims_registrar_scscf/common.c

---

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

---

diff --git a/src/modules/ims_registrar_scscf/common.c b/src/modules/ims_registrar_scscf/common.c
index f3faf5dfdb..3b4ab685e3 100644
--- a/src/modules/ims_registrar_scscf/common.c
+++ b/src/modules/ims_registrar_scscf/common.c
@@ -85,7 +85,7 @@ int extract_aor(str* _uri, str* _a) {
 
 	_a->s = aor_buf;
 	_a->len = puri.user.len + 4;
-	strncpy(_a->s, "sip:", 4);
+	memcpy(_a->s, "sip:", 4);
 
 	str tmps;
 	tmps.s = _a->s + 4;




More information about the sr-dev mailing list