[PATCH] drm/nouveau: replace snprintf() with scnprintf() in nvkm_snprintbf()

Danilo Krummrich dakr at kernel.org
Sat Aug 9 12:00:19 UTC 2025


On 7/24/25 9:59 PM, Seyediman Seyedarab wrote:
> snprintf() returns the number of characters that *would* have been
> written, which can overestimate how much you actually wrote to the
> buffer in case of truncation. That leads to 'data += this' advancing
> the pointer past the end of the buffer and size going negative.
> 
> Switching to scnprintf() prevents potential buffer overflows and ensures
> consistent behavior when building the output string.
> 
> Signed-off-by: Seyediman Seyedarab <ImanDevel at gmail.com>

Applied to drm-misc-next, thanks!


More information about the dri-devel mailing list