From nobody Wed Mar 02 21:57:19 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 6479119E0822; Wed, 2 Mar 2022 21:57:20 +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 4K87JJ0dLmz3KSt; Wed, 2 Mar 2022 21:57:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1646258240; 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=7NR2hvtaMzBz+8jz0M3D1AqJfntATMiDx1E4CnuIdQE=; b=etv0gLIpVr6vJX17oclL9W2ga63n0b/ZH0H87Phd0v2XNKc1gwcaDGFAlJ6I5R34SJTmX6 KGVBM/agpB80lAaWfB7/9biFYzT7nS0Hcu7fSCpv31Qv6Wptp/LtTZqwKZcOjWYzYtqFJ+ maBd4mOvKqyMntHwtgs2fv+CHU6w1U/DsNsLYIeUfB6V4wKAMyuKssQ1WZIb/pkL2ngO70 JtQlvskspXhbBXlwag+0scrPbzdl8QC6b23qWbzpdFK7sxMANsmonHD8NO1oGFkOVb2Loy tUThcPHHle/fClygn+Ksky+2nCkNiEV3qlEZv7H/o9CwNQzgifZ/ecVwvWc72w== 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 4C30A3465; Wed, 2 Mar 2022 21:57:19 +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 222LvJvE065066; Wed, 2 Mar 2022 21:57:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 222LvJpp065065; Wed, 2 Mar 2022 21:57:19 GMT (envelope-from git) Date: Wed, 2 Mar 2022 21:57:19 GMT Message-Id: <202203022157.222LvJpp065065@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Eric van Gyzen Subject: git: ac20fa249f12 - stable/13 - aio_md_test: NUL-terminate result of readlink 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: vangyzen X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: ac20fa249f129b5c1eb65d378baf4f954dd03bc9 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1646258240; 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=7NR2hvtaMzBz+8jz0M3D1AqJfntATMiDx1E4CnuIdQE=; b=Hf7WzweCXSN8WHhHyYrFYwUeL+phVzskNqDY61ApQveiSeWoQXcUNcEuCYOdBs2TMoPb5B 7vDaji7Y8fWIiqzT0RWq5kTeQVVhTF/72gcmPpZHcBTbG4SiYg3oA9eiGNboGpc5VGt+tJ DsMiyOnjBdIzIex00RDoUNrCoaQRgp6OJSriBTFzNGwdUhXqXTpLREVW/yoAEUohepbhDN RGJXNMz2ROriXBXNLzBBDxTs/O3JmgP72z/WCtC6Ew0HbInE40siXxA2St84z+32Tu222U 8BMX78Y9VtxJYesSRGgXh69o5PtT8TPSkIauRIhcBqheEz1rGHLM3Bsmo99PCw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1646258240; a=rsa-sha256; cv=none; b=g0Wrk+Qwn4Clm8YkjHCr1hAuDx97/dqnmEEZe2t7x9yoUDpRS7xoztS+Dsfl+udjpjEhtP FRfbT1s+yxju+426d9YQlqWulJn/eHhR595Xnh7z0pWytpGij3tFhbebsWhcJMIwTtPDFD QPTsmKTjRC10+TVjvtDy0OR6GMsBWK7vyEmLLGYLxrXmaskC76AP9zyCd97MGnNWnsFnRu L6F9cmKTR9knnn8iZE8u6grQ45/e9nPup8wXCW3FO+Dc8Xm/Z/ucdUON+kx0kFUg7dEzhy Ci6p49j7IASHWYk5thoIHj8uVepGC2cYLUrINNB9AkVkkKxP7reGNGjCI58Uwg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by vangyzen: URL: https://cgit.FreeBSD.org/src/commit/?id=ac20fa249f129b5c1eb65d378baf4f954dd03bc9 commit ac20fa249f129b5c1eb65d378baf4f954dd03bc9 Author: Eric van Gyzen AuthorDate: 2021-07-23 13:49:55 +0000 Commit: Eric van Gyzen CommitDate: 2022-03-02 21:56:30 +0000 aio_md_test: NUL-terminate result of readlink readlink does not NUL-terminate the output buffer. This led to spurious failures to destroy the md device because the unit number was garbage. NUL-terminate the output buffer. Reported by: ASLR MFC after: 1 week Sponsored by: Dell EMC Isilon (cherry picked from commit ea0e1b19f232331bffa75a0a64a6859c40f1cc4d) --- tests/sys/aio/aio_test.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/sys/aio/aio_test.c b/tests/sys/aio/aio_test.c index af2e3823d1ff..0f929c510e9f 100644 --- a/tests/sys/aio/aio_test.c +++ b/tests/sys/aio/aio_test.c @@ -767,8 +767,9 @@ aio_md_cleanup(void) strerror(errno)); return; } - n = readlink(MDUNIT_LINK, buf, sizeof(buf)); + n = readlink(MDUNIT_LINK, buf, sizeof(buf) - 1); if (n > 0) { + buf[n] = '\0'; if (sscanf(buf, "%d", &unit) == 1 && unit >= 0) { bzero(&mdio, sizeof(mdio)); mdio.md_version = MDIOVERSION;