dmidecode-devel
[Top][All Lists]
Advanced

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

Re: [dmidecode] [PATCH] dmidecode: Fix crash with option -u


From: Jerry Hoemann
Subject: Re: [dmidecode] [PATCH] dmidecode: Fix crash with option -u
Date: Mon, 18 Jan 2021 09:53:57 -0700

On Mon, Jan 18, 2021 at 02:11:01PM +0100, Jean Delvare wrote:
> A segmentation fault was reported with option -u. Turns out to be a
> stupid thinko where the buffer offset was reset at the wrong loop
> depth.
> 
> Reported-by: Jerry Hoemann <jerry.hoemann@hpe.com>
> Fixes: da06888d08b9 ("dmidecode: Use the print helpers in dump mode too")
> Signed-off-by: Jean Delvare <jdelvare@suse.de>
> ---
> Jerry, does that work for you?


I don't get any more core dumps using "-u" on any field of any
of my saved binary dumps.

I haven't hand decoded the binary dumps, so I'm assuming
the tool is printing the correct data.

> 
>  dmidecode.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> --- dmidecode.orig/dmidecode.c        2021-01-18 13:56:38.278222177 +0100
> +++ dmidecode/dmidecode.c     2021-01-18 13:57:01.850502525 +0100
> @@ -248,9 +248,9 @@ static void dmi_dump(const struct dmi_he
>                       {
>                               int j, l = strlen(s) + 1;
>  
> -                             off = 0;
>                               for (row = 0; row < ((l - 1) >> 4) + 1; row++)
>                               {
> +                                     off = 0;
>                                       for (j = 0; j < 16 && j < l - (row << 
> 4); j++)
>                                               off += sprintf(raw_data + off,
>                                                      j ? " %02X" : "%02X",
> 
> 
> -- 
> Jean Delvare
> SUSE L3 Support

-- 

-----------------------------------------------------------------------------
Jerry Hoemann                  Software Engineer   Hewlett Packard Enterprise
-----------------------------------------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]