On Mon, 01 Jun 2026 at 10:55 PM, Sean McBride <[email protected]>
wrote:

> On 1 Jun 2026, at 16:46, Branko Čibej wrote:
>
> > I prefer to just silence the brain-dead warning...
>
> The warning is hardly brain-dead. sprintf() cannot be implemented safely
> as it has no idea how big the buffer is. Memory overruns are an infamous
> problem in C, and using sprintf() in 2026 is madness IMNSHO.
>
> OpenBSD has this same warning as macOS BTW.



Well, at the end of the day macos is in fact a BSD based system ;)

About memory safety, if we know the buffer has enough memory, it’s okay. I
completely agree with Branko. I believe in that snippet of code, the
function is used to format a number which realistically could never exceed
like 16 bytes.

I wouldn’t say you should avoid a specific function just because you don’t
like it or somebody on the internet says so. It’s fine whenever you know
what you’re doing.

Then, some day it leads to Rust rewrites…


>

Reply via email to