[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

From: Paul Vixie
Subject: Re: [Nmh-workers] strncpy(3), die, die, die.
Date: Tue, 25 Oct 2016 09:58:07 -0700
User-agent: Postbox 5.0.5 (Windows/20161020)

Steffen Nurpmeso wrote:
> Paul Vixie <address@hidden> 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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]