From nobody Mon Nov 16 15:17:54 2026 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 4jSs1Z4fjqz70rLT for ; Mon, 16 Nov 2026 15:17:54 +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) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4jSs1Z2THRz4RHY for ; Mon, 16 Nov 2026 15:17:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794842274; 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=+0xK81yzSW0kHAJDhOCAiC7PuLaVFg4wpP7ALbPf6Tc=; b=DSuwX4q9OAvnjS7TWYmZbtmS5AnjJMn4L5ty+FxIrMVDdrfllRyJq+CgTTSZCl4Suc+TUZ KyNWBzHFoCVmKtV4GvRzTO24t1cXslfT4m7DKpHZsK/YoLeloJ/zsdQKQyVfSgXhy/teMi 0/D5lCcH66do3cNz7EP4pkCibg2naR0MHTXbBlMkFL9vuZ+nEtQa65E17YMzsBD/rDct4D sofeF1c+RdcWVNTRubPNzU988oeACfN+6Q43G8eXszeo+VK3463G8tZ+BueUoAVCAKUjDq Rnt5KPuwkbyckCFu203s/fMLeQ910Ew+PpnL0Frw5wvuSm/s07cgBOQnVB+OUg== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1794842274; b=wYd1+y+Y6PEsWmoMPVB7BXXlO6TJhzVPn03cSf2lRE93uvd3QYf62UoqYoUgLOx6+FqKHf 8qc74e3g+YPrSjkSo+R3cXAthJDFtLnItHeVk+Y8OMA7qodKqwOgS9NVKLeCg4N0wIS6an VAs75nfFRGtGi7iV35sYgGssgPfq/DChaubWmugNwNGee4ccoHv/UTIp/DcASK2oTKT7wP mkgmnPVgYQQa0XHZMwMI6V51Cr0jKBDErtq1RK8OhQBz0Q+9QFDXh3FUmcThRDmEuue5B7 agg2i8T7h0ej5ZBHLpIWCRnpYrNErktqmR3LQzJoSTMI7t+MZeR/LpqPh6WMbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794842274; 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=+0xK81yzSW0kHAJDhOCAiC7PuLaVFg4wpP7ALbPf6Tc=; b=m+/O0LBiBkel9DQF/08qx1NbSMY6fV+bJC6SINVaYQQCc7C+TmLA6DF7KYNUFUxuCEiaCl omxNmEgoIZV9kzbxbJGZj6nOPXPdVansoYBP6vJsRFypbsBV5+gNlCmeWG9nIaSXlw/yyV EEk6FRR+gGDnUkWoXqpx/CQLDI4C3XIcb1fTO7NnHL4OXHR8PW2Y+JWIYuivjw7Yf4jfbs kkp14QrCYZkw6xLVZbBZshyqqHGRi9KTSiErPet2vuuoFfTumdGEbRexztxk7uFG/QWEqv UCO4nthgEXgVgl2FLaMqmYwebjqlWIvvL1cfMvPk8tbRi0leNaQizA9sVVUyBw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4jSs1Z28Cwz10DG for ; Mon, 16 Nov 2026 15:17:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 4354 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 16 Nov 2026 15:17:54 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dag-Erling=?utf-8?Q? Sm=C3=B8rg?=rav Subject: git: a74f742b2c5e - stable/14 - tftpd: Fix off-by-one in get_field() List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all X-BeenThere: dev-commits-src-all@freebsd.org List-Id: Commit messages for all branches of the src repository List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: des X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: a74f742b2c5e6f75e56f03c32f631b7d1b9855c5 Auto-Submitted: auto-generated Date: Mon, 16 Nov 2026 15:17:54 +0000 Message-Id: <6afb1ea2.4354.43cb7b83@gitrepo.freebsd.org> The branch stable/14 has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=a74f742b2c5e6f75e56f03c32f631b7d1b9855c5 commit a74f742b2c5e6f75e56f03c32f631b7d1b9855c5 Author: Dag-Erling Smørgrav AuthorDate: 2026-11-11 19:45:14 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2026-11-16 14:52:03 +0000 tftpd: Fix off-by-one in get_field() Due to a logic error, get_field() would behave as if the passed-in size was one greater than it actually is. Fix it so it always fails if no terminating NUL is found within the buffer, instead of succeeding if the first byte past the end is a NUL. MFC after: 1 week Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D61032 (cherry picked from commit 14541ca2bf3766e659a22c5ea9ed3dc2d5f11fa5) --- libexec/tftpd/tftp-utils.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/libexec/tftpd/tftp-utils.c b/libexec/tftpd/tftp-utils.c index 8ce7c09c9992..9cda798462e6 100644 --- a/libexec/tftpd/tftp-utils.c +++ b/libexec/tftpd/tftp-utils.c @@ -109,16 +109,15 @@ get_field(int peer, char *buffer, size_t size) { char *cp = buffer; - while (cp < buffer + size) { - if (*cp == '\0') break; + while (size > 0) { + if (*cp == '\0') + return (cp - buffer + 1); cp++; + size--; } - if (*cp != '\0') { - tftp_log(LOG_ERR, "Bad option - no trailing \\0 found"); - send_error(peer, EBADOP); - exit(1); - } - return (cp - buffer + 1); + tftp_log(LOG_ERR, "Bad option - no trailing \\0 found"); + send_error(peer, EBADOP); + exit(1); } /*