2014-10-16 23:17 GMT+02:00 Andrew Morton :
> On Thu, 16 Oct 2014 23:09:00 +0200 Rickard Strandqvist
> wrote:
>
>> 2014-10-16 0:15 GMT+02:00 Andrew Morton :
>> > On Sun, 5 Oct 2014 15:06:17 +0200 Rickard Strandqvist
>> > wrote:
>> >
>> >> Added a function strzcpy which works the same as strncpy
On Thu, 16 Oct 2014 23:09:00 +0200 Rickard Strandqvist
wrote:
> 2014-10-16 0:15 GMT+02:00 Andrew Morton :
> > On Sun, 5 Oct 2014 15:06:17 +0200 Rickard Strandqvist
> > wrote:
> >
> >> Added a function strzcpy which works the same as strncpy,
> >> but guaranteed to produce the trailing null ch
2014-10-16 0:15 GMT+02:00 Andrew Morton :
> On Sun, 5 Oct 2014 15:06:17 +0200 Rickard Strandqvist
> wrote:
>
>> Added a function strzcpy which works the same as strncpy,
>> but guaranteed to produce the trailing null character.
>>
>> There are many places in the code where strncpy used although
On Sun, 5 Oct 2014 15:06:17 +0200 Rickard Strandqvist
wrote:
> Added a function strzcpy which works the same as strncpy,
> but guaranteed to produce the trailing null character.
>
> There are many places in the code where strncpy used although it
> must be zero terminated, and switching to str
Added a function strzcpy which works the same as strncpy,
but guaranteed to produce the trailing null character.
There are many places in the code where strncpy used although it
must be zero terminated, and switching to strlcpy is not an option
because the string must nonetheless be fyld with zero
I've added a strzcpy to make it easier to not do wrong
when you use the function strncpy.
Often one needs the zero padding, but must still have a
guaranteed zero character terminat.
Then you end up writing code like this:
strncpy(to, src, sizeof(to));
to[sizeof(to) - 1] = '\0';
This is solved
6 matches
Mail list logo