On Mon, 05 Feb 2018 14:21:07 + Ralph Corderoy wrote:
Ralph Corderoy writes:
> Hi,
>
> Valdis wrote:
> > I'd be quite surprised if we don't have at least one off-by-one error
> > in there.
>
> Separate from those errors, a lot of the code doesn't care if the char[]
>
>Yes, I like asprintf(), but it's not POSIX. snprintf(NULL, 0, fmt, ...)
>is POSIX and returns the strlen() of what would have been written,
>allowing a second call to do the work, again, for real this time.
A quick glance suggests to me that even while asprintf() is not part of
POSIX, it is on
Ralph Corderoy wrote:
...> There was a long `strncpy(3), die, die, die.' thread back in 2016 about
this, including that strncpy() pads to the full 8 KiB with NULs. My
to-do list summarises what I think was the conclusion.
- Add trunccpy() for when truncation is correct, e.g. the start of
Hi,
Valdis wrote:
> I'd be quite surprised if we don't have at least one off-by-one error
> in there.
Separate from those errors, a lot of the code doesn't care if the char[]
ends up unterminated and continue to use the result assuming it is.
IOW, it assumes the char[] is `big enough', and at 8