Date: Tue, 3 Dec 2024 20:04:58 GMT From: Gleb Smirnoff <glebius@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 0601c0f989f2 - main - netlink: check buffer length fits into u_int Message-ID: <202412032004.4B3K4w5Z061670@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=0601c0f989f21a935d49818d67e732766ddc3f77 commit 0601c0f989f21a935d49818d67e732766ddc3f77 Author: Gleb Smirnoff <glebius@FreeBSD.org> AuthorDate: 2024-12-03 20:04:22 +0000 Commit: Gleb Smirnoff <glebius@FreeBSD.org> 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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202412032004.4B3K4w5Z061670>