Module: kamailio Branch: master Commit: daad89a516f1f298ef8f71505d7ab93b35fe76db URL: https://github.com/kamailio/kamailio/commit/daad89a516f1f298ef8f71505d7ab93b...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2018-09-20T16:37:15+02:00
path: use memcpy() instead of strncpy()
- avoid gcc 8.2 warning: âstrncpyâ output truncated before terminating nul
---
Modified: src/modules/path/path.c
---
Diff: https://github.com/kamailio/kamailio/commit/daad89a516f1f298ef8f71505d7ab93b... Patch: https://github.com/kamailio/kamailio/commit/daad89a516f1f298ef8f71505d7ab93b...
---
diff --git a/src/modules/path/path.c b/src/modules/path/path.c index 5b29a33527..f95d68ab70 100644 --- a/src/modules/path/path.c +++ b/src/modules/path/path.c @@ -406,8 +406,8 @@ void path_rr_callback(struct sip_msg *_m, str *r_param, void *cb_param) } } else { /* received=ip~port~proto */ - strncpy(dst_uri_buf, "sip:", 4); - strncpy(dst_uri_buf+4, hooks.contact.received->body.s, + memcpy(dst_uri_buf, "sip:", 4); + memcpy(dst_uri_buf+4, hooks.contact.received->body.s, hooks.contact.received->body.len); dst_uri_buf[4+hooks.contact.received->body.len] = '\0'; p = dst_uri_buf + 4; @@ -433,7 +433,7 @@ void path_rr_callback(struct sip_msg *_m, str *r_param, void *cb_param) LM_ERR("unknown proto in received param\n"); goto done; } - strncpy(p, "transport=", 10); + memcpy(p, "transport=", 10); p += 10; memcpy(p, sproto.s, sproto.len); p += sproto.len;