From nobody Mon Sep 15 22:09:51 2025 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 4cQfMz4mJ3z687gQ; Mon, 15 Sep 2025 22:09:51 +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 "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4cQfMz3y8Qz3SvJ; Mon, 15 Sep 2025 22:09:51 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1757974191; 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=WaVKwC3xJT7jb7h9KYtc/n00+TBB+iRRZfuMMjnQeTE=; b=TF/oFUJTIkODpE/wUMz3nJmViJkEVjLzUCUy3AIPy0mQLM7PyeEnCLS9iQ8uuWAVh6acsW edoEWNh3znzTqHd5lbGrTt+gng7LWHcrXehygKHG8/9Q77i9pH1I7MCg/vzJjwyV2/KA06 qO6TkUZI928wdRtJ+n1gOKjFMF73f5bSTQBjCD7lQatYcqosEDNaB7h041yh+YGmthBN9p G1Nw5P0cbuQhrizn5QtocKFMv7aadpMREZ3mDGNG38MF9nUTyiMUf+pEHzBdCHl48c0RQb K2qKt87AqEmqOTZCmKRaQOiELlHMjnzvYwtBW5CqNrlp/PfryKKBLgFaiH647A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1757974191; 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=WaVKwC3xJT7jb7h9KYtc/n00+TBB+iRRZfuMMjnQeTE=; b=nq0ASSh2NIdukk0hS0TJAz0RhCd+ooUrjRmy2ztuaW2S7ArRBPKRoYgcjODhEVcvBUHBgG beKwg2rqf4AiUP/mcPJKHk75qOfsAEsRh/dwEGZ0k6gphrTMfAdpKb7TsxIcPwfQ3tMYB+ GtbtvcIugFWs9HkgxnuEGS8UZshtku+pnNj/I9scFmUJaSKv91MyeegBrq8kvY28mTWxHp VaSPcQ5nxcOYLU47Ea8fQ/JAw6Ov1yiampen3zWTOkqlesqT01EsPNi6g4slERjjFZAmOK 8/mU3DPPTumBEPXcG9KZA1NOp7TNgf4NxLrHqBKjoDzcTVeRgZ3FYXjoTm/Dew== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1757974191; a=rsa-sha256; cv=none; b=DSczGVBF6JuS05Tf36tdGUGUpYuWMeX7rZ/JpvucYQNZuTX8ANPIygTptAbs6GsLzUXIKU rginfxZQF2imZOz7M4RU7+fBmSTnGxJbiGi6yiycWgIjkq0f/Zkmu53xePvyBmL4xnuml1 CXEVvmdjnHw+j3TFydxQXZ6YMswv0CsmHTeg+VzOcFPUmglUPVzvZrhJf5B8NeaMxgELLB Q8S5OEHjYcWyRWGMW/0gnG4liPqCHja8voD4BnlNdOGZlYexOYK0Ti76H33gfUT5SbbtZq 3ndPNqW8Y2PZ2pSrb2FTB5uj+VN8aJabNYjHpcZI0P46baW+nxLzx3CxmVaeWw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4cQfMz3X0Nz1Bs0; Mon, 15 Sep 2025 22:09:51 +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 58FM9pKd077704; Mon, 15 Sep 2025 22:09:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 58FM9ptY077701; Mon, 15 Sep 2025 22:09:51 GMT (envelope-from git) Date: Mon, 15 Sep 2025 22:09:51 GMT Message-Id: <202509152209.58FM9ptY077701@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alex Richardson Subject: git: 969be39fb3ca - main - if_ovpn.c: fix use of uninitialized variable 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 969be39fb3caf4272f128dbf3267ceba5966a6ce Auto-Submitted: auto-generated The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=969be39fb3caf4272f128dbf3267ceba5966a6ce commit 969be39fb3caf4272f128dbf3267ceba5966a6ce Author: Alex Richardson AuthorDate: 2025-09-15 22:08:43 +0000 Commit: Alex Richardson CommitDate: 2025-09-15 22:08:44 +0000 if_ovpn.c: fix use of uninitialized variable In case we use OVPN_CIPHER_ALG_NONE, the memcpy will attempt to copy 0 bytes from an uninitialized pointer. While the memcpy() implementation will treat this as a no-op and not actually dereferece the undefined variable it is still undefined behaviour to the compiler and should be fixed. Found by building with clang HEAD Reviewed by: kp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D52543 --- sys/net/if_ovpn.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/net/if_ovpn.c b/sys/net/if_ovpn.c index fe015632f33e..1c18baac3417 100644 --- a/sys/net/if_ovpn.c +++ b/sys/net/if_ovpn.c @@ -904,9 +904,11 @@ ovpn_create_kkey_dir(struct ovpn_kkey_dir **kdirp, kdir->cipher = cipher; kdir->keylen = keylen; kdir->tx_seq = 1; - memcpy(kdir->key, key, keylen); + if (keylen != 0) + memcpy(kdir->key, key, keylen); kdir->noncelen = ivlen; - memcpy(kdir->nonce, iv, ivlen); + if (ivlen != 0) + memcpy(kdir->nonce, iv, ivlen); if (kdir->cipher != OVPN_CIPHER_ALG_NONE) { /* Crypto init */