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

List:       serdev
Subject:    [sr-dev] git:master:a8eed67b: imc: use memcpy() instead of strncpy()
From:       Victor Seva <linuxmaniac () torreviejawireless ! org>
Date:       2018-09-28 12:42:49
Message-ID: E1g5s6b-0004d1-Dm () www ! kamailio ! org
[Download RAW message or body]

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


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

imc: use memcpy() instead of strncpy()

> imc_cmd.c: In function 'imc_handle_list':
> imc_cmd.c:810:2: warning: 'strncpy' output truncated before terminating nul copying \
> 9 bytes from a string of the same length [-Wstringop-truncation] strncpy(p, \
> "Members:\n", 9); ^~~~~~~~~~~~~~~~~~~~~~~~~~~

---

Modified: src/modules/imc/imc_cmd.c

---

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


---

diff --git a/src/modules/imc/imc_cmd.c b/src/modules/imc/imc_cmd.c
index 1514e2c956..a6288610a6 100644
--- a/src/modules/imc/imc_cmd.c
+++ b/src/modules/imc/imc_cmd.c
@@ -807,7 +807,7 @@ int imc_handle_list(struct sip_msg* msg, imc_cmd_t *cmd,
 		goto error;
 	}
 	p = imc_body_buf;
-	strncpy(p, "Members:\n", 9);
+	memcpy(p, "Members:\n", 9);
 	p+=9;
 	imp = room->members;
 


_______________________________________________
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