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: <DM6PR04MB65754DC90E423A79D80263C1FC149@DM6PR04MB6575.namprd04.prod.outlook.com>
Date:   Tue, 13 Jul 2021 08:00:23 +0000
From:   Avri Altman <Avri.Altman@....com>
To:     "oracleks043021@...il.com" <oracleks043021@...il.com>,
        "beanhuo@...ron.com" <beanhuo@...ron.com>,
        "kenny.gibbons@...cle.com" <kenny.gibbons@...cle.com>,
        "kimito.sakata@...cle.com" <kimito.sakata@...cle.com>,
        "rkamdar@...ron.com" <rkamdar@...ron.com>,
        "chris@...ntf.net" <chris@...ntf.net>,
        "ulf.hansson@...aro.org" <ulf.hansson@...aro.org>
CC:     "linux-mmc@...r.kernel.org" <linux-mmc@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH v1] mmc-utils: Fix for Firmware Version string printing

> 
> From: Kimito Sakata <kimito.sakata@...cle.com>
> 
> Added a local buffer to create a NULL terminated string to print the
> Firmware Version instead of attempting to print directly from
> ext_csd buffer. The last byte of the Firmware Version field may not
> be NULL and the next field may also not be which may cause it to
> print garbage.
> 
> Tested on x86 platform.
Fixes: 89cd01ed865a (mmc_utils: add ffu support)

Signed-off-by: Kimito Sakata <kimito.sakata@...cle.com>
Reviewed-by: Avri Altman <avri.altman@....com>

> ---
>  mmc_cmds.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/mmc_cmds.c b/mmc_cmds.c
> index afa85b7..205e6e5 100644
> --- a/mmc_cmds.c
> +++ b/mmc_cmds.c
> @@ -1392,6 +1392,7 @@ int do_read_extcsd(int nargs, char **argv)
>         __u32 regl;
>         int fd, ret;
>         char *device;
> +       char lbuf[10];
>         const char *str;
> 
>         if (nargs != 2) {
> @@ -1833,8 +1834,9 @@ int do_read_extcsd(int nargs, char **argv)
>         }
> 
>         if (ext_csd_rev >= 7) {
> -               printf("eMMC Firmware Version: %s\n",
> -                       (char*)&ext_csd[EXT_CSD_FIRMWARE_VERSION]);
> +                memset(lbuf, 0, sizeof(lbuf));
> +               strncpy(lbuf, (char*)&ext_csd[EXT_CSD_FIRMWARE_VERSION], 8);
> +               printf("eMMC Firmware Version: %s\n", lbuf);
>                 printf("eMMC Life Time Estimation A
> [EXT_CSD_DEVICE_LIFE_TIME_EST_TYP_A]: 0x%02x\n",
>                         ext_csd[EXT_CSD_DEVICE_LIFE_TIME_EST_TYP_A]);
>                 printf("eMMC Life Time Estimation B
> [EXT_CSD_DEVICE_LIFE_TIME_EST_TYP_B]: 0x%02x\n",
> --
> 2.31.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ