lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.OSX.2.00.1705061459240.688@n5127mncfb42q1.qlogic.org>
Date:   Sat, 6 May 2017 15:00:17 -0400 (EDT)
From:   Chad Dupuis <chad.dupuis@...ium.com>
To:     Kees Cook <keescook@...omium.org>
cc:     Bart Van Assche <Bart.VanAssche@...disk.com>,
        "linux-scsi@...r.kernel.org" <linux-scsi@...r.kernel.org>,
        "jejb@...ux.vnet.ibm.com" <jejb@...ux.vnet.ibm.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "QLogic-Storage-Upstream@...ium.com" 
        <QLogic-Storage-Upstream@...ium.com>,
        "danielmicay@...il.com" <danielmicay@...il.com>,
        "martin.petersen@...cle.com" <martin.petersen@...cle.com>
Subject: Re: [PATCH] scsi: qedf: Avoid reading past end of buffer


On Fri, 5 May 2017, 7:10pm, Kees Cook wrote:

> On Fri, May 5, 2017 at 4:01 PM, Bart Van Assche
> <Bart.VanAssche@...disk.com> wrote:
> > On Fri, 2017-05-05 at 15:42 -0700, Kees Cook wrote:
> >> diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c
> >> index cceddd995a4b..a5c97342fd5d 100644
> >> --- a/drivers/scsi/qedf/qedf_main.c
> >> +++ b/drivers/scsi/qedf/qedf_main.c
> >> @@ -2895,7 +2895,7 @@ static int __qedf_probe(struct pci_dev *pdev, int mode)
> >>       slowpath_params.drv_minor = QEDF_DRIVER_MINOR_VER;
> >>       slowpath_params.drv_rev = QEDF_DRIVER_REV_VER;
> >>       slowpath_params.drv_eng = QEDF_DRIVER_ENG_VER;
> >> -     memcpy(slowpath_params.name, "qedf", QED_DRV_VER_STR_SIZE);
> >> +     strncpy(slowpath_params.name, "qedf", QED_DRV_VER_STR_SIZE);
> >>       rc = qed_ops->common->slowpath_start(qedf->cdev, &slowpath_params);
> >>       if (rc) {
> >>               QEDF_ERR(&(qedf->dbg_ctx), "Cannot start slowpath.\n");
> >
> > Hello Kees,
> >
> > Although this patch looks fine to me, isn't strlcpy() preferred over strncpy()?
> 
> strlcpy doesn't zero-pad, so I think strncpy is preferred here,
> otherwise we may risk leaving portions of the destination buffer
> filled with uninitialized data, maybe leaking kernel memory contents.
> 
> -Kees
> 

I'd agree with strncpy so we zero out the rest of the buffer.

Acked-by: Chad Dupuis <chad.dupuis@...ium.com> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ