Re: [PATCH v2] mpi3mr: Fix W=1 compilation warnings

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

 



On Wed, Jul 7, 2021 at 12:09 AM Martin K. Petersen
<martin.petersen@xxxxxxxxxx> wrote:
>
>
> Sreekanth,
>
> > I verified strscpy() is not adding any null terminator when source
> > string length is greater than destination buffer size.
>
> That's odd. The point of strscpy() is that it guarantees termination:
>
> ---8<---
> /**
>  * strscpy - Copy a C-string into a sized buffer
>  * @dest: Where to copy the string to
>  * @src: Where to copy the string from
>  * @count: Size of destination buffer
>  *
>  * Copy the string, or as much of it as fits, into the dest buffer.  The
>  * behavior is undefined if the string buffers overlap.  The destination
>  * buffer is always NUL terminated, unless it's zero-sized.
> ---8<---
>
> I tested it and it works fine for me.

Ok, my bad. I made a small mistake while verifying it. Now I rectified
it and saw that strscpy() is adding a NULL character at the end.

Thanks,
Sreekanth

>
> --
> Martin K. Petersen      Oracle Linux Engineering

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux