aboutsummaryrefslogtreecommitdiffstats
path: root/lib/erl_interface/src/legacy/erl_connect.c
diff options
context:
space:
mode:
authorMichael Santos <[email protected]>2011-01-23 18:16:36 -0500
committerBjörn-Egil Dahlberg <[email protected]>2011-02-22 16:37:17 +0100
commiteed4341a21b8e2c8e00d0321bde1213d7a4359df (patch)
tree6c19d9745ff984796f6c62b2d36093016c69417d /lib/erl_interface/src/legacy/erl_connect.c
parentb0d6abb72cf32df548703b284b737a4a7c0a9d8a (diff)
downloadotp-eed4341a21b8e2c8e00d0321bde1213d7a4359df.tar.gz
otp-eed4341a21b8e2c8e00d0321bde1213d7a4359df.tar.bz2
otp-eed4341a21b8e2c8e00d0321bde1213d7a4359df.zip
erl_interface: fix buffer overflows
Diffstat (limited to 'lib/erl_interface/src/legacy/erl_connect.c')
-rw-r--r--lib/erl_interface/src/legacy/erl_connect.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/erl_interface/src/legacy/erl_connect.c b/lib/erl_interface/src/legacy/erl_connect.c
index 3c8c946506..e77bd5db37 100644
--- a/lib/erl_interface/src/legacy/erl_connect.c
+++ b/lib/erl_interface/src/legacy/erl_connect.c
@@ -180,9 +180,7 @@ int erl_xconnect(Erl_IpAddr addr, char *alivename)
*
* Close a connection. FIXME call ei_close_connection() later.
*
- * Returns valid file descriptor on success and < 0 on failure.
- * Set erl_errno to EHOSTUNREACH, ENOMEM, EIO or errno from socket(2)
- * or connect(2).
+ * Returns 0 on success and -1 on failure.
*
***************************************************************************/
@@ -250,7 +248,8 @@ int erl_send(int fd, ETERM *to ,ETERM *msg)
return -1;
}
- strcpy(topid.node, (char *)ERL_PID_NODE(to));
+ strncpy(topid.node, (char *)ERL_PID_NODE(to), sizeof(topid.node));
+ topid.node[sizeof(topid.node)-1] = '\0';
topid.num = ERL_PID_NUMBER(to);
topid.serial = ERL_PID_SERIAL(to);
topid.creation = ERL_PID_CREATION(to);