[prev in list] [next in list] [prev in thread] [next in thread] 

List:       serdev
Subject:    [sr-dev] git:master:93ff141b: ims_registrar_scscf: use memcpy() instead of strncpy()
From:       Victor Seva <linuxmaniac () torreviejawireless ! org>
Date:       2018-09-28 12:42:51
Message-ID: E1g5s6d-0004eQ-Ku () www ! kamailio ! org
[Download RAW message or body]

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


Author: Victor Seva <linuxmaniac@torreviejawireless.org>
Committer: Victor Seva <linuxmaniac@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;


_______________________________________________
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic