aboutsummaryrefslogtreecommitdiffstats
path: root/lib/erl_interface/src
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2011-05-11 12:03:50 +0200
committerBjörn-Egil Dahlberg <[email protected]>2011-05-11 12:03:50 +0200
commit68fe6a14539b82250373ef114d6576e74e1b8f2e (patch)
tree6dc9626a9d58db4a767c67b3250b89a653ff5bb3 /lib/erl_interface/src
parent2ef48dca9328e0b928117f21bc9ee6dbc5a614cc (diff)
parent7e486d747d5a4813c617eaaa94c2aba6f5ecf4d5 (diff)
downloadotp-68fe6a14539b82250373ef114d6576e74e1b8f2e.tar.gz
otp-68fe6a14539b82250373ef114d6576e74e1b8f2e.tar.bz2
otp-68fe6a14539b82250373ef114d6576e74e1b8f2e.zip
Merge branch 'gl/erl_do_receive_msg/OTP-9241' into dev
* gl/erl_do_receive_msg/OTP-9241: The function 'erl_xreceive_msg' returned garbage in the 'to' and 'to_name' members of the message. The reason for that was found in the 'erl_do_receive_msg' function. When no 'pid' is provided by the sender, like when doing rpc calls as those uses registered name sends, it doesn't initialize the 'to' member and also the 'to_name' member is copied by the function.
Diffstat (limited to 'lib/erl_interface/src')
-rw-r--r--lib/erl_interface/src/legacy/erl_connect.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/erl_interface/src/legacy/erl_connect.c b/lib/erl_interface/src/legacy/erl_connect.c
index fdf689e191..41d4fa3138 100644
--- a/lib/erl_interface/src/legacy/erl_connect.c
+++ b/lib/erl_interface/src/legacy/erl_connect.c
@@ -293,8 +293,13 @@ static int erl_do_receive_msg(int fd, ei_x_buff* x, ErlMessage* emsg)
emsg->msg = NULL;
if (msg.from.node[0] != '\0')
emsg->from = erl_mk_pid(msg.from.node, msg.from.num, msg.from.serial, msg.from.creation);
+ else
+ emsg->from = NULL;
if (msg.to.node[0] != '\0')
emsg->to = erl_mk_pid(msg.to.node, msg.to.num, msg.to.serial, msg.to.creation);
+ else
+ emsg->to = NULL;
+ memcpy(emsg->to_name, msg.toname, MAXATOMLEN+1);
return r;
}