Re: [PATCH] scsi: zfcp: Replace strlcpy() with strscpy()

2023-11-20 Thread Benjamin Block
Hey Kees, thanks for the patch. can you please send this patch to linux-scsi and CC the SCSI Maintainers (Martin and James) instead (having linux-s390 on CC is fine)? zFCP doesn't go via s390, being a SCSI driver. On Thu, Nov 16, 2023 at 11:14:35AM -0800, Kees Cook wrote: > strlcpy() reads the e

Re: [PATCH] scsi: zfcp: Replace strlcpy() with strscpy()

2023-11-19 Thread Alexander Gordeev
On Fri, Nov 17, 2023 at 07:19:48PM +0100, Alexander Gordeev wrote: > > @@ -900,8 +900,15 @@ static void zfcp_fc_rspn(struct zfcp_adapter *adapter, > > zfcp_fc_ct_ns_init(&rspn_req->ct_hdr, FC_NS_RSPN_ID, > >FC_SYMBOLIC_NAME_SIZE); > > hton24(rspn_req->rspn.fr_fid.fp_

Re: [PATCH] scsi: zfcp: Replace strlcpy() with strscpy()

2023-11-17 Thread Alexander Gordeev
On Thu, Nov 16, 2023 at 11:14:35AM -0800, Kees Cook wrote: Hi Kees, > diff --git a/drivers/s390/scsi/zfcp_fc.c b/drivers/s390/scsi/zfcp_fc.c > index 4f0d0e55f0d4..1a29f10767fc 100644 > --- a/drivers/s390/scsi/zfcp_fc.c > +++ b/drivers/s390/scsi/zfcp_fc.c > @@ -900,8 +900,15 @@ static void zfcp_fc

[PATCH] scsi: zfcp: Replace strlcpy() with strscpy()

2023-11-16 Thread Kees Cook
strlcpy() reads the entire source buffer first. This read may exceed the destination size limit. This is both inefficient and can lead to linear read overflows if a source string is not NUL-terminated[1]. Additionally, it returns the size of the source string, not the resulting size of the destinat