From nobody Fri Jun 17 19:39:08 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 26A4685BD28; Fri, 17 Jun 2022 19:39:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4LPq9S4Lwbz3R4D; Fri, 17 Jun 2022 19:39:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1655494749; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=PH55y2FaeCxRaWWjTPpLxLTkzefFVOfN57bWdkeRFn0=; b=Ze742szxmDAj2BDpELo1+1M44VNlP12Nh21tfWd0/DwZAaMuEsXb/xAUO0KGs4QUAkF/Xe X7y7MwQAGM9N/sHx9iRq5lVVKSlaBu+TO8ZsHikYU1swfiDGhsGsQQFRL/jkNZMfqtJabi LUQ/DTCst4rQKdllAT174QSk7pATDZADzURn3xsPoKGhjItw+THhKzv2YCNpIAK/VBwd2H YYEWX52WTE32nOJHZ6Dp85wW82dWpWpD0ZzPNpcFRaxU/A9EGeT62/lgUDSBHUp3wn/In0 XfezzLVPLPmkHcpNyyNhopP2X7ltV/2ebDwZAkmXwtloaYQ8JtJumEsjEyAFkg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5443525C4E; Fri, 17 Jun 2022 19:39:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 25HJd8Aj015607; Fri, 17 Jun 2022 19:39:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 25HJd8fg015606; Fri, 17 Jun 2022 19:39:08 GMT (envelope-from git) Date: Fri, 17 Jun 2022 19:39:08 GMT Message-Id: <202206171939.25HJd8fg015606@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dmitry Chagin Subject: git: ecf8f499683e - stable/13 - linux(4): Limit user-supplied sockaddr length in recvfrom(). List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: ecf8f499683eaed387852d22f177639a7e34df9a Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1655494749; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=PH55y2FaeCxRaWWjTPpLxLTkzefFVOfN57bWdkeRFn0=; b=yWi28hxdSD8Byh0s8q5jRSpVcEqRw3FgT66bxI1ZUvbhl5kyMJZ5mEif6f3mzU7Z73+hbg oNGoGxwSH5O0MN4UcMPQC4YHsvab32e8XI/GGtoOD14JCWuc5HoMaladUjJRMkvp4AzFfD OWmNRW+3McpejDtUyaQjdfqHgPl6kOT2fW9TxoL2IIhs93NFBDV9vidbwGlKV6vu+qqv3n o/kvHYVHF20TDAcCIvIPUS26nulZX4wgQ1WUT5SBOpABJN3EAVbWk6SAvZ5IaPC7WgRxOw umy1XgAIonYP6SjFCQ9Nifbt/FYMYok2vIZ9YSCyHc+fpi0Q7Qql0NpANZjpAQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1655494749; a=rsa-sha256; cv=none; b=yh/J1bMz9A4rX83MRLvkzHIlPbSGIHzoseLZYFGxNHO1jT2UPyuwaZLinCXiyUzLk5brer 2DY4+Z75w0X7cjvLL1X/1JnMB8ZbjaV83ZVRRmyaAWrdk0ndQ301RCKTwPDfgKj+5WzRo6 KeLn/fj0bBkIDPaaoreWQV4w631NvLWGeO7ZllD0Yf9yTRpl/mikCenARy4t7qOjt/UavM uUTyXg0kr2xz9SABHhQMV92rf13tYysd3XlL/rd9+EdvWFXaoG1Oru/KJxJW0U1TofWBx1 137dR3of5/Gi3SBhn3IaAPln3crADnc0IScV3xiXa8ja2+KCtOTQrEFZppaeJg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=ecf8f499683eaed387852d22f177639a7e34df9a commit ecf8f499683eaed387852d22f177639a7e34df9a Author: Dmitry Chagin AuthorDate: 2022-04-11 20:32:28 +0000 Commit: Dmitry Chagin CommitDate: 2022-06-17 19:33:52 +0000 linux(4): Limit user-supplied sockaddr length in recvfrom(). Differential Revision: https://reviews.freebsd.org/D34726 (cherry picked from commit bb0f644cd680d20b3112f6c14dc853171f497a88) --- sys/compat/linux/linux_socket.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/compat/linux/linux_socket.c b/sys/compat/linux/linux_socket.c index 16e8c7dadb98..622e25651dbb 100644 --- a/sys/compat/linux/linux_socket.c +++ b/sys/compat/linux/linux_socket.c @@ -1272,6 +1272,7 @@ linux_recvfrom(struct thread *td, struct linux_recvfrom_args *args) return (error); if (fromlen < 0) return (EINVAL); + fromlen = min(fromlen, SOCK_MAXADDRLEN); sa = malloc(fromlen, M_SONAME, M_WAITOK); } else { fromlen = 0;