From 7e486d747d5a4813c617eaaa94c2aba6f5ecf4d5 Mon Sep 17 00:00:00 2001 From: Goran Larsson Date: Tue, 26 Apr 2011 17:14:29 +0800 Subject: 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. --- lib/erl_interface/src/legacy/erl_connect.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lib/erl_interface') 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; } -- cgit v1.2.3