nmh-workers
[Top] [All Lists]

Re: [Nmh-workers] strncpy(3), die, die, die.

2016-10-25 11:58:28


Steffen Nurpmeso wrote:
Paul Vixie <paul(_at_)redbarn(_dot_)org> wrote:
 |...

I think the former and latter of the above have the problem that
they return useless information: the size that would be necessary
to store the result in a non-truncated form.  If that information
would be collected regulary using the above functions i would
think that this is really wasteful software that gives a s..t on
the necessity of, e.g., atomic plants etc.  I think it is this
kind of mental direction that brings us all down.

...

i can't tell whether you're arguing for truncation. if so, i'm the
downer your parents warned you about. truncation is by definition
undefined, and a program should not continue once its state is undefined.

we could meet somewhere near the middle by replacing strcpy with a macro
that called strlcpy, looked at the returned result, and either
overwrites the target buffer with a '\0' or calls abort, depending on
the setting of an environment variable.

-- 
P Vixie


_______________________________________________
Nmh-workers mailing list
Nmh-workers(_at_)nongnu(_dot_)org
https://lists.nongnu.org/mailman/listinfo/nmh-workers

<Prev in Thread] Current Thread [Next in Thread>