From nobody Sun Dec 24 14:02:42 2023 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 4SyjR64wrsz54fhj; Sun, 24 Dec 2023 14:02:42 +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 4SyjR64LCvz4FB5; Sun, 24 Dec 2023 14:02:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703426562; 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=lJbR3dc8QzSxFDL8G3x+qdnVB10wM74s6jsxxshmBTI=; b=PU0M8oIdKMc6xgFICYpdnO9zhL5kKjgCdoSxJ1nfw7eyTQ7oHyKSMtrr+rgnU/PMsnLQOw WlOolxRfaYzSyFP4Zmvhaf11I/xF5sPwG+Wq8zxuWbF64iqXdCkgQLR7KSZoKbmgQHSxV/ GjnnRcmqAs1ViWYVQNCNUDS8DiCBjoupM6c3OxlpWRJUrIuEvAvOlOIKAvdVClasZbv8CT /8rWfvAxA4vvYXV2/lShH246nmXx50y6PxChyMqt+HFNyDSl8XDa8tu31zXVCpGhQRpTpw CPTZ+f8g/jpfhSLc11jVEVQFU+Q3NWv4r1yVTcH9RQEHRf53NlyMSZd7sZygDA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703426562; a=rsa-sha256; cv=none; b=cKtb70urRh9kCqSVNTOYd9epJ3l+AC3y8+FRRbZ0fgmHO3qrPDsxWBZOcM8wdvdoq9uFsk fYCdcoaJFqEQUg7RMavgrUB7zuEPemmN25e8alJ3npeKqoXxAMVmjJKKfb5xMsdJ7yg3G7 CtUSWEDA/fVvjJ6emdpSedly9DewI6F6cbMyoYJXzXHIk2byfmjim+2SKmbbXvG4M28rcv +YuDxGyTLwm21OgOrCb7jHZiMqKFRkqNHq1tsFqVi7Zc2A+WN6J4E98an4kNQp/fn9f648 wqHbbPPf22egO+DNexOXPv6yxOQ+y6jJCplTnWb+e7+RnerN6O4Fqg0zguXkXQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703426562; 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=lJbR3dc8QzSxFDL8G3x+qdnVB10wM74s6jsxxshmBTI=; b=wbCIxmPYbWNw69qXLRiJ+laWPdn8AsCj3q7nSCnRx1PLFLJbS8qlWZMN3JOHokbw+OfqsC OnfyX0sg1ySfPAb6+6H3EjgS6PsBFMPy8c6m3bOWCqnpGCPL5pzIaxQAZGFjGMgwc2IQ0b x8PufvDgS6LjfnqhTZ8hwkCdxnSBxd+77ADyOIJni3s6xM5xi6Fk4eR8s+1JAD7ixwJRSk ATOI+XX8Mw9NWnRXgNpoOHmHl7QN5SYO24yK1rRAjmXYUei5JdqfK7PlNf8yaXqEjC6qfm 2tS81yQUPk7Gtz9MhxCpK9W0GOIEkeFIzpSrdvxy1BVXjVaT7ZPuoqo1AiuI1g== 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 4SyjR63RwXzWSV; Sun, 24 Dec 2023 14:02:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BOE2gBt057463; Sun, 24 Dec 2023 14:02:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BOE2gKm057460; Sun, 24 Dec 2023 14:02:42 GMT (envelope-from git) Date: Sun, 24 Dec 2023 14:02:42 GMT Message-Id: <202312241402.3BOE2gKm057460@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dimitry Andric Subject: git: 4f3aa626f614 - stable/13 - Fix snprintf truncation in telnet 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: dim X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 4f3aa626f614a5ea5cfdfff4f77caa9ec10980bb Auto-Submitted: auto-generated The branch stable/13 has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=4f3aa626f614a5ea5cfdfff4f77caa9ec10980bb commit 4f3aa626f614a5ea5cfdfff4f77caa9ec10980bb Author: Dimitry Andric AuthorDate: 2023-12-21 22:35:17 +0000 Commit: Dimitry Andric CommitDate: 2023-12-24 14:01:29 +0000 Fix snprintf truncation in telnet Building telnet with clang 18 results in the following warning: contrib/telnet/telnet/telnet.c:231:5: error: 'snprintf' will always be truncated; specified size is 10, but format string expands to at least 11 [-Werror,-Wformat-truncation] 231 | snprintf(temp2, sizeof(temp2), "%c%c%c%c....%c%c", IAC, SB, TELOPT_COMPORT, | ^ The temp2 buffer is 10 chars, while the format string also consists of 10 chars. Therefore, snprintf(3) will truncate the last character, 'SE' (end sub negotation) in this case. Bump the buffer to 11 chars to avoid truncation. MFC after: 3 days (cherry picked from commit c794d188222a4d3414233ff9630d47eedc090fbe) --- contrib/telnet/telnet/telnet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/telnet/telnet/telnet.c b/contrib/telnet/telnet/telnet.c index b6b2432ef3ec..a98dad499c7b 100644 --- a/contrib/telnet/telnet/telnet.c +++ b/contrib/telnet/telnet/telnet.c @@ -208,7 +208,7 @@ unsigned char ComPortBaudRate[256]; void DoBaudRate(char *arg) { - char *temp, temp2[10]; + char *temp, temp2[11]; int i; uint32_t baudrate;