Module: kamailio Branch: 5.1 Commit: aac37ac2aed455da79c406cc597ccc74d9138322 URL: https://github.com/kamailio/kamailio/commit/aac37ac2aed455da79c406cc597ccc74...
Author: Seudin Kasumovic seudin.kasumovic@gmail.com Committer: Seudin Kasumovic seudin.kasumovic@gmail.com Date: 2018-01-04T09:22:39+01:00
erlang: fix copy into fixed size buffer of node name
Use length of node name string to avoid write past the end of the fixed-size destination buffer.
(cherry picked from commit 53a76a4ae828cf08fbdebe08918706bd7d7d76d2)
---
Modified: src/modules/erlang/cnode.c
---
Diff: https://github.com/kamailio/kamailio/commit/aac37ac2aed455da79c406cc597ccc74... Patch: https://github.com/kamailio/kamailio/commit/aac37ac2aed455da79c406cc597ccc74...
---
diff --git a/src/modules/erlang/cnode.c b/src/modules/erlang/cnode.c index 0eae7a716c..ce24c1dff4 100644 --- a/src/modules/erlang/cnode.c +++ b/src/modules/erlang/cnode.c @@ -111,7 +111,8 @@ int cnode_connect_to(cnode_handler_t *phandler, ei_cnode *ec, const str *nodenam LM_DBG("... connected to %.*s %s:%u\n", STR_FMT(nodename), ip_addr2strz(&ip), port); }
- strcpy(phandler->conn.nodename, nodename->s); + strncpy(phandler->conn.nodename, nodename->s, nodename->len); + phandler->conn.nodename[nodename->len] = 0;
/* for #Pid */ phandler->ec.self.num = phandler->sockfd;