aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2010-11-22 12:05:55 +0100
committerBjörn-Egil Dahlberg <[email protected]>2010-11-22 12:05:59 +0100
commit0f2f7ddea021441d79abbfda1cb915fe755cb766 (patch)
treeb5f0c9e5d833557deac117112e05a8bf9d056cf5
parent4819bd39799777427965963625f034e30673b034 (diff)
parentcea06983d15d2c268e4ff6af47edfdadfa189c8b (diff)
downloadotp-0f2f7ddea021441d79abbfda1cb915fe755cb766.tar.gz
otp-0f2f7ddea021441d79abbfda1cb915fe755cb766.tar.bz2
otp-0f2f7ddea021441d79abbfda1cb915fe755cb766.zip
Merge branch 'ms/ei-fix-node-name-overflow' into dev
* ms/ei-fix-node-name-overflow: ei: check the length of the node name OTP-8943
-rw-r--r--lib/erl_interface/src/epmd/epmd_publish.c6
-rw-r--r--lib/erl_interface/src/epmd/epmd_unpublish.c5
2 files changed, 11 insertions, 0 deletions
diff --git a/lib/erl_interface/src/epmd/epmd_publish.c b/lib/erl_interface/src/epmd/epmd_publish.c
index a9b8727747..d45fe644c0 100644
--- a/lib/erl_interface/src/epmd/epmd_publish.c
+++ b/lib/erl_interface/src/epmd/epmd_publish.c
@@ -69,6 +69,12 @@ static int ei_epmd_r4_publish (int port, const char *alive, unsigned ms)
int n;
int res, creation;
+ if (len > sizeof(buf)-2)
+ {
+ erl_errno = ERANGE;
+ return -1;
+ }
+
s = buf;
put16be(s,len);
diff --git a/lib/erl_interface/src/epmd/epmd_unpublish.c b/lib/erl_interface/src/epmd/epmd_unpublish.c
index 08662fe1ec..495cbab44c 100644
--- a/lib/erl_interface/src/epmd/epmd_unpublish.c
+++ b/lib/erl_interface/src/epmd/epmd_unpublish.c
@@ -59,6 +59,11 @@ int ei_unpublish_tmo(const char *alive, unsigned ms)
int len = 1 + strlen(alive);
int fd, res;
+ if (len > sizeof(buf)-3) {
+ erl_errno = ERANGE;
+ return -1;
+ }
+
put16be(s,len);
put8(s,EI_EPMD_STOP_REQ);
strcpy(s, alive);