aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGoran Larsson <[email protected]>2011-04-26 17:14:29 +0800
committerGoran Larsson <[email protected]>2011-04-26 17:14:29 +0800
commit7e486d747d5a4813c617eaaa94c2aba6f5ecf4d5 (patch)
tree2fc4fa23101f02d2e56903b3dc4cf8b551b56f6c
parentf228601de45c5b53241b103af6616453c50885a5 (diff)
downloadotp-7e486d747d5a4813c617eaaa94c2aba6f5ecf4d5.tar.gz
otp-7e486d747d5a4813c617eaaa94c2aba6f5ecf4d5.tar.bz2
otp-7e486d747d5a4813c617eaaa94c2aba6f5ecf4d5.zip
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.
-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;
}