[Top][All Lists]

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

Re: [PATCH] target/s390x/arch_dump: Fix memory corruption in s390x_write

From: Thomas Huth
Subject: Re: [PATCH] target/s390x/arch_dump: Fix memory corruption in s390x_write_elf64_notes()
Date: Wed, 15 Feb 2023 06:20:59 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.13.0

On 14/02/2023 15.58, Philippe Mathieu-Daudé wrote:
On 14/2/23 15:10, Thomas Huth wrote:
"note_size" can be smaller than sizeof(note), so unconditionally calling
memset(notep, 0, sizeof(note)) could cause a memory corruption here in
case notep has been allocated dynamically, thus let's use note_size as
length argument for memset() instead.


I wonder why use one notep* pointing to a stack allocated or a heap
allocated buffer. This isn't hot path, one heap use could simplify
this code complexity IMO.

You've got a point. I'll give it a try and send a v2.


reply via email to

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