diff options
author | Rickard Green <[email protected]> | 2019-04-30 16:46:27 +0200 |
---|---|---|
committer | Rickard Green <[email protected]> | 2019-04-30 17:29:20 +0200 |
commit | e05ce24868c8391103faea7de3f230fa8f2ce0a2 (patch) | |
tree | 80ee1e86c1979cfa20ef940fcdbaabb10263bd1e /lib/erl_interface/src | |
parent | 68a90eb777b5c1e48c0760337fbf2b0b8a9aa6aa (diff) | |
download | otp-e05ce24868c8391103faea7de3f230fa8f2ce0a2.tar.gz otp-e05ce24868c8391103faea7de3f230fa8f2ce0a2.tar.bz2 otp-e05ce24868c8391103faea7de3f230fa8f2ce0a2.zip |
Increase max number of node name characters to 256
Diffstat (limited to 'lib/erl_interface/src')
-rw-r--r-- | lib/erl_interface/src/connect/ei_connect.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/erl_interface/src/connect/ei_connect.c b/lib/erl_interface/src/connect/ei_connect.c index 7a304e6d4f..95cb10a20c 100644 --- a/lib/erl_interface/src/connect/ei_connect.c +++ b/lib/erl_interface/src/connect/ei_connect.c @@ -791,14 +791,17 @@ int ei_connect_init_ussi(ei_cnode* ec, const char* this_node_name, if (strcmp(hp->h_name, "localhost") == 0) { /* We use a short node name */ if ((ct = strchr(thishostname, '.')) != NULL) *ct = '\0'; - sprintf(thisnodename, "%s@%s", this_node_name, thishostname); } else { /* We use a short node name */ if ((ct = strchr(hp->h_name, '.')) != NULL) *ct = '\0'; strcpy(thishostname, hp->h_name); - sprintf(thisnodename, "%s@%s", this_node_name, hp->h_name); } } + if (strlen(this_node_name) + 1 + strlen(thishostname) > MAXNODELEN) { + EI_TRACE_ERR0("ei_connect_init_ussi","this node name is too long"); + return ERL_ERROR; + } + sprintf(thisnodename, "%s@%s", this_node_name, thishostname); res = ei_connect_xinit_ussi(ec, thishostname, thisalivename, thisnodename, (struct in_addr *)*hp->h_addr_list, cookie, creation, cbs, cbs_sz, setup_context); @@ -889,6 +892,11 @@ int ei_connect_tmo(ei_cnode* ec, char *nodename, unsigned ms) int ei_h_errno; #endif /* !win32 */ int res; + + if (strlen(nodename) > MAXNODELEN) { + EI_TRACE_ERR0("ei_connect","Too long nodename"); + return ERL_ERROR; + } /* extract the host and alive parts from nodename */ if (!(hostname = strchr(nodename,'@'))) { |