[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CA+FuTSeBmuk0OOG_Psmj-WGz6njWDEpFLnwsUHUAMHjuc3a-rg@mail.gmail.com>
Date: Wed, 27 Nov 2019 12:13:40 -0500
From: Willem de Bruijn <willemdebruijn.kernel@...il.com>
To: Stephen Hemminger <stephen@...workplumber.org>
Cc: Network Development <netdev@...r.kernel.org>
Subject: Re: Fw: [Bug 205681] New: recvmg is overwriting the buffer passed in
msg_name by exceeding msg_namelen
On Wed, Nov 27, 2019 at 11:09 AM Stephen Hemminger
<stephen@...workplumber.org> wrote:
>
>
>
> Begin forwarded message:
>
> Date: Wed, 27 Nov 2019 06:36:50 +0000
> From: bugzilla-daemon@...zilla.kernel.org
> To: stephen@...workplumber.org
> Subject: [Bug 205681] New: recvmg is overwriting the buffer passed in msg_name by exceeding msg_namelen
>
>
> https://bugzilla.kernel.org/show_bug.cgi?id=205681
>
> Bug ID: 205681
> Summary: recvmg is overwriting the buffer passed in msg_name by
> exceeding msg_namelen
> Product: Networking
> Version: 2.5
> Kernel Version: 5.4,4.0,3.0,2.6
> Hardware: All
> OS: Linux
> Tree: Mainline
> Status: NEW
> Severity: high
> Priority: P1
> Component: IPV4
> Assignee: stephen@...workplumber.org
> Reporter: sudheendrasp@...il.com
> Regression: No
>
> if (msg->msg_name) {
> struct sockaddr_rxrpc *srx = msg->msg_name;
> size_t len = sizeof(call->peer->srx);
>
> memcpy(msg->msg_name, &call->peer->srx, len);
> srx->srx_service = call->service_id;
> msg->msg_namelen = len;
> }
>
>
> As seen, recvmsg is doing memcpy of len which can be greater than msg_namelen
> passed.
__sys_recvfrom in net/socket.c always passes a struct of size
sockaddr_storage to the protocol handler. On return from the protocol
handler it calls move_addr_to_user to safely copy up to msg_namelen
only.
Powered by blists - more mailing lists