提交 2dd08dfd 编写于 作者: J Joakim Tjernlund 提交者: Riku Voipio

alloca one extra byte sockets

target_to_host_sockaddr() may increase the lenth with 1 byte
for AF_UNIX sockets so allocate 1 extra byte.
Signed-off-by: NJoakim Tjernlund <Joakim.Tjernlund@transmode.se>
Reviewed-by: NPeter Maydell <peter.maydell@linaro.org>
Signed-off-by: NRiku Voipio <riku.voipio@linaro.org>
上级 33a29b51
......@@ -1984,7 +1984,7 @@ static abi_long do_connect(int sockfd, abi_ulong target_addr,
return -TARGET_EINVAL;
}
addr = alloca(addrlen);
addr = alloca(addrlen+1);
ret = target_to_host_sockaddr(addr, target_addr, addrlen);
if (ret)
......@@ -2005,7 +2005,7 @@ static abi_long do_sendrecvmsg_locked(int fd, struct target_msghdr *msgp,
if (msgp->msg_name) {
msg.msg_namelen = tswap32(msgp->msg_namelen);
msg.msg_name = alloca(msg.msg_namelen);
msg.msg_name = alloca(msg.msg_namelen+1);
ret = target_to_host_sockaddr(msg.msg_name, tswapal(msgp->msg_name),
msg.msg_namelen);
if (ret) {
......@@ -2268,7 +2268,7 @@ static abi_long do_sendto(int fd, abi_ulong msg, size_t len, int flags,
if (!host_msg)
return -TARGET_EFAULT;
if (target_addr) {
addr = alloca(addrlen);
addr = alloca(addrlen+1);
ret = target_to_host_sockaddr(addr, target_addr, addrlen);
if (ret) {
unlock_user(host_msg, msg, 0);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册