Module: kamailio
Branch: master
Commit: 53a76a4ae828cf08fbdebe08918706bd7d7d76d2
URL:
https://github.com/kamailio/kamailio/commit/53a76a4ae828cf08fbdebe08918706b…
Author: Seudin Kasumovic <seudin.kasumovic(a)gmail.com>
Committer: Seudin Kasumovic <seudin.kasumovic(a)gmail.com>
Date: 2018-01-03T23:21:41+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.
---
Modified: src/modules/erlang/cnode.c
---
Diff:
https://github.com/kamailio/kamailio/commit/53a76a4ae828cf08fbdebe08918706b…
Patch:
https://github.com/kamailio/kamailio/commit/53a76a4ae828cf08fbdebe08918706b…
---
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;