From nobody Tue Dec 03 20:04:58 2024 X-Original-To: dev-commits-src-main@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 4Y2s7t3mlMz5ggWy; Tue, 03 Dec 2024 20:04:58 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y2s7t2QqGz4l9q; Tue, 3 Dec 2024 20:04:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733256298; 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=Qzp5SMGpbjLBaUw5nXkRpLLFEYs17+BWu1UHVyCdZaQ=; b=fi2Yk4+L7iTFFvmNYTrhTQiVn8j9XsdJRHHHB/sjO15U0uKe+hGfaZPBivflYCElGq3Zmc joe/61ry32DbrPgvA2ymrdVQgLfVoBbcJoWYDL6qQtP4oiukgrSn2Db0qt6HY5oW8dvrrd f9QKGl3o0c445XX8YVLdXjF7xxhCdVusWtrsHSttb0OkJ2NiApsiqYaZhbL0EyI7V/1Ekc nDKOtFr55lT8swBwR19D2+jnHUt7RAIYd2GdrV+EYgrCzODkQrIxF47fHxeOUwWESY2vRx J+EHfGktgrsO9McpQrZvFaHAP9kfy+dYI32T9CgEfdgLy2tjRg0FW3hYvM2jaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733256298; 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=Qzp5SMGpbjLBaUw5nXkRpLLFEYs17+BWu1UHVyCdZaQ=; b=ss+PYcexTXKntcaqsqXgwdu9X/TKg7JGmPSqRAVk/r7sV5/gyH/emG+OZY4U9hWx42zOTG rpbB874aVXe7UHpQ4wZBPGItPvGgXZBABbbqvnN+ZXXXq2lJ0PI1y7ghvxSY1yma/wYkcR zklIKVX0fZuwsCddpF4NpMDyGpBFqMAfsc8CVe8seYslo/Z2LAxTwcoPIYUFww1ZoWiyOr +Tvh2Q5wjoz5EdVGRWRWBUYPVxh9g0++xfJ5dE8LYCpmptV/wRguKeVGvFhFceWM9LDs6N AsezYQQHoybh06QbNmZ4WJx9S5AWGUQwn9leIgq+r45F3rt7BOFowz5G6Dcmxw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733256298; a=rsa-sha256; cv=none; b=mx2r/5EptrBAeOgUpcdRhkKLDFv55REdMkZ1pLGN9IYxIylM10flCh3ufsjaCJdLoRb2Hk CmhR/Vl1x2PgrkY9XF94c7WWir9DkERrBHFMdFtd4OF6EtGb9FB4FRsAj3zOzngdW55kxm +rzIpWFRZhGdkIdpbGq6tpkyuW9LXaOFvONwwfrWFhHquBsRj/t8P0YLwA+xiGCh1/FDeO VbWBWoLrhPz3T5xUdQj3twwhYkVgOMp33niMnm8k9IpUvlQ9sbFwTmEm1a9qPIxWALCA8S Adrl6LUB2QUz3us6lAIohvTUY/IjP7oNDgb99f/AQn/ZUPUZWBI9uzKqL/jTkw== 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 4Y2s7t1zqSzcl1; Tue, 3 Dec 2024 20:04:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4B3K4wKW061673; Tue, 3 Dec 2024 20:04:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4B3K4w5Z061670; Tue, 3 Dec 2024 20:04:58 GMT (envelope-from git) Date: Tue, 3 Dec 2024 20:04:58 GMT Message-Id: <202412032004.4B3K4w5Z061670@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: 0601c0f989f2 - main - netlink: check buffer length fits into u_int List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0601c0f989f21a935d49818d67e732766ddc3f77 Auto-Submitted: auto-generated The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=0601c0f989f21a935d49818d67e732766ddc3f77 commit 0601c0f989f21a935d49818d67e732766ddc3f77 Author: Gleb Smirnoff AuthorDate: 2024-12-03 20:04:22 +0000 Commit: Gleb Smirnoff CommitDate: 2024-12-03 20:04:22 +0000 netlink: check buffer length fits into u_int We may increase it to size_t later, KPI allows that already, but doesn't seem to be needed today. Reviewed by: melifaro Differential Revision: https://reviews.freebsd.org/D47550 --- sys/netlink/netlink_io.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/netlink/netlink_io.c b/sys/netlink/netlink_io.c index bc8d2f9fcc3f..d2022a6a2b0d 100644 --- a/sys/netlink/netlink_io.c +++ b/sys/netlink/netlink_io.c @@ -58,6 +58,9 @@ nl_buf_alloc(size_t len, int mflag) { struct nl_buf *nb; + KASSERT(len > 0 && len <= UINT_MAX, ("%s: invalid length %zu", + __func__, len)); + nb = malloc(sizeof(struct nl_buf) + len, M_NETLINK, mflag); if (__predict_true(nb != NULL)) { nb->buflen = len;