nano-devel
[Top][All Lists]
Advanced

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

Re: [Nano-devel] Proposal: remove or change mallocstrncpy() so that it i


From: Eitan Adler
Subject: Re: [Nano-devel] Proposal: remove or change mallocstrncpy() so that it is more safe & less cumbersome
Date: Wed, 13 Apr 2016 21:30:58 -0700

On 13 April 2016 at 20:23, Mike Scalora <address@hidden> wrote:
> mallocstrncpy() unsurprisingly has the same pitfall as strncpy(), namely it
> null terminates strings EXCEPT if the string has n non-nulll characters.
> This is somewhat defensible in strncpy()'s case because it is useful for
> packed character fields that are not null terminated but mallocstrncpy() is
> always allocating a new buffer so it's never the case that the next byte
> might be a different field.
...
> What do you think?

Why not directly use strndup?



-- 
Eitan Adler



reply via email to

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