]> www.infradead.org Git - users/jedix/linux-maple.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>
Sun, 13 Oct 2024 16:17:35 +0000 (18:17 +0200)
commit02ac3a9ef3a18b58d8f3ea2b6e46de657bf6c4f9
treed371bcba62de97db769fe1df0671b3cc2c72eeb9
parent7528cb0f65d7472c1d6b96956f86b408c5ab6b11
parport: Proper fix for array out-of-bounds access

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