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

List:       sr-dev
Subject:    [sr-dev] git:master:b81068eb: mohqueue: use memcpy() instead of strncpy()
From:       Victor Seva <linuxmaniac () torreviejawireless ! org>
Date:       2018-09-28 12:42:50
Message-ID: E1g5s6c-0004dG-5J () www ! kamailio ! org
[Download RAW message or body]

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


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

mohqueue: use memcpy() instead of strncpy()

> mohq_funcs.c: In function 'notify_msg':
> mohq_funcs.c:1475:3: warning: 'strncpy' output truncated before terminating nul \
> copying 2 bytes from a string of the same length [-Wstringop-truncation] strncpy \
> (&pbody->s [pbody->len], SIPEOL, 2);

---

Modified: src/modules/mohqueue/mohq_funcs.c

---

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


---

diff --git a/src/modules/mohqueue/mohq_funcs.c b/src/modules/mohqueue/mohq_funcs.c
index 50eb9bfca0..96bdb335d0 100644
--- a/src/modules/mohqueue/mohq_funcs.c
+++ b/src/modules/mohqueue/mohq_funcs.c
@@ -1469,10 +1469,10 @@ if (!pbody->s)
   LM_ERR ("%sNo more memory!\n", pfncname);
   return;
   }
-strncpy (pbody->s, pfrag, pbody->len);
+memcpy (pbody->s, pfrag, pbody->len);
 if (pbody->s [pbody->len - 1] != '\n')
   {
-  strncpy (&pbody->s [pbody->len], SIPEOL, 2);
+  memcpy (&pbody->s [pbody->len], SIPEOL, 2);
   pbody->len += 2;
   }
 struct msg_start pstart [1];


_______________________________________________
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