]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
parport: Proper fix for array out-of-bounds access
authorTakashi Iwai <tiwai@suse.de>
Fri, 20 Sep 2024 10:32:19 +0000 (12:32 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 22 Oct 2024 13:40:46 +0000 (15:40 +0200)
commit440311903231c6e6c9bcf8acb6a2885a422e00bc
tree732229c974c4fbc09c07b7a1ff4cbed4fc76155a
parent88a892071d228057757301a777b6b44c099ba155
parport: Proper fix for array out-of-bounds access

commit 02ac3a9ef3a18b58d8f3ea2b6e46de657bf6c4f9 upstream.

The recent fix for array out-of-bounds accesses replaced sprintf()
calls blindly with snprintf().  However, since snprintf() returns the
would-be-printed size, not the actually output size, the length
calculation can still go over the given limit.

Use scnprintf() instead of snprintf(), which returns the actually
output letters, for addressing the potential out-of-bounds access
properly.

Fixes: ab11dac93d2d ("dev/parport: fix the array out-of-bounds risk")
Cc: stable@vger.kernel.org
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240920103318.19271-1-tiwai@suse.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/parport/procfs.c