[<prev] [next>] [day] [month] [year] [list]
Message-ID: <CA+XYpCAq24zaDb-mnWqjs3N2SvbXsGLiT1COzWqQJnaKivb1hw@mail.gmail.com>
Date: Wed, 2 Jul 2025 20:24:32 +0800
From: Jake <jakecontactxyz@...il.com>
To: linux-kernel@...r.kernel.org
Cc: akpm@...ux-foundation.org
Subject: [PATCH] vsnprintf: POSIX compliance for return value length
Greetings.
The current implementation of vsnprintf() returns the number of characters
actually written to the buffer, which does not comply with the POSIX
specification. POSIX requires vsnprintf() to return the number of characters
it *would* have written, even if that exceeds the buffer size, so callers
can
detect truncation.
This patch adds a `total_len` counter, updates all output paths to increment
it, and returns `total_len` instead of the truncated output count.
Signed-off-by: Jake <jakecontactxyz@...il.com>
Content of type "text/html" skipped
Download attachment "vsnprintf_patch.zip" of type "application/zip" (1384 bytes)
Powered by blists - more mailing lists