Re: [PATCH 08/14] d_path: make prepend_name() boolean

From: Al Viro
Date: Thu May 20 2021 - 15:37:02 EST


On Thu, May 20, 2021 at 04:53:38PM +0200, Petr Mladek wrote:

> That said. vsnprintf() returns the number of characters which would
> be generated for the given input. But only the "size" is written.
> This require copying the characters one by one.

Not really - that's more of avoiding trouble if the sucker gets renamed
right under prepend_name(). Note that we have no way to guarantee that
length and string pointer come from the same moment. This looking for
NUL is about protection againts stepping off the end of allocated object.