From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7C4FF3815E6; Sat, 12 Sep 2026 10:07:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789207630; cv=none; b=REyUzFheAbcst8FkoxRnUXlVYpZat3+KO6Iz1K9OYIvsTl63cwe35hziwaiSP+jHLszG6GRfRMQpE9ztotQwerw38snKFuZexAo8wWjQ+TWmH3RsYLW9UGccZKzIz/0keve6k4K5sMOfmEcTY5OOc9Z0s0q0wziDe+pcHuifOk8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789207630; c=relaxed/simple; bh=k4eB/ZJgGepgWSNq62UXX+5m5pzDgzmsqT7j88ZVHCE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rXqjjzyBrNtY51rj04QkCUgY0hHAEgaiqBkXL+29RLZvK2/uAPSFfUgOLz2lVw3+X8QcQmxFnqYLi2HDfV6DOnFHUit8w6fVvPNPIUFX43axwP+txXAFLv8LuWraglHYG86KosE+gHSgUKUzoZlYR0cQrZOUl/Jy8iqtawNBofc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=S3t/rXBJ; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="S3t/rXBJ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5CC111F000FF; Sat, 12 Sep 2026 10:07:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789207627; bh=MgxSBfbkWKkx0WA601Cru2JMOyMQWYIVWOkEtW2fNXc=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=S3t/rXBJmcB3xEKTturM6GDsEg1UXB7WXuNKfZCtjE9PRBClSS2V09rtvfiUSEHMI ZW5tFQy6BHdpZXAaBwbp1g9GN5xUBZ26O+cxFLQKZZTtyOkYO98yWrauz2csrLIo41 FKR+rybPwDvdVkCGVe9PjNMYnBmbveGbnVpv/SS4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Christophe JAILLET , Samuel Thibault , Dan Carpenter , Sasha Levin Subject: [PATCH 6.18 0450/1518] accessibility: speakup: Fix incorrect string length computation in report_char_chartab_status() Date: Sat, 12 Sep 2026 08:43:39 +0200 Message-ID: <20260912065633.629234576@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260912065623.398859879@linuxfoundation.org> References: <20260912065623.398859879@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Christophe JAILLET [ Upstream commit bce0e640623372520d9d90c42f33ddbfb576ce69 ] snprintf() returns the "number of characters which *would* be generated for the given input", not the size *really* generated. In order to avoid too large values for 'len' (and potential negative values for "sizeof(buf) - (len - 1)") use scnprintf() instead of snprintf(). Fixes: c6e3fd22cd53 ("Staging: add speakup to the staging directory") Signed-off-by: Christophe JAILLET Signed-off-by: Samuel Thibault Reviewed-by: Samuel Thibault Reviewed-by: Dan Carpenter Link: https://patch.msgid.link/20260531230804.254962-5-samuel.thibault@ens-lyon.org Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/accessibility/speakup/kobjects.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/accessibility/speakup/kobjects.c b/drivers/accessibility/speakup/kobjects.c index 0dfdb6608e022..943ef71b1329b 100644 --- a/drivers/accessibility/speakup/kobjects.c +++ b/drivers/accessibility/speakup/kobjects.c @@ -92,9 +92,9 @@ static void report_char_chartab_status(int reset, int received, int used, if (reset) { pr_info("%s reset to defaults\n", object_type[do_characters]); } else if (received) { - len = snprintf(buf, sizeof(buf), - " updated %d of %d %s\n", - used, received, object_type[do_characters]); + len = scnprintf(buf, sizeof(buf), + " updated %d of %d %s\n", + used, received, object_type[do_characters]); if (rejected) snprintf(buf + (len - 1), sizeof(buf) - (len - 1), " with %d reject%s\n", -- 2.53.0