[PATCH v2] xilinx: versal: Fix snprintf invalid size argument

Francois Berder fberder at outlook.fr
Thu Jul 2 17:28:30 CEST 2026


Hello Michal,


On 7/2/26 16:40, Michal Simek wrote:
> 
> 
> On 7/2/26 15:54, Francois Berder wrote:
>> buf is an array of size DFU_ALT_BUF_LEN bytes.
>> It is gradually filled with data using snprintf but the
>> size argument to snprintf is kept at DFU_ALT_BUF_LEN,
>> making it possible to overflow the buffer.
>> Fix this bug using the correct buffer size:
>> DFU_ALT_BUF_LEN - len.
>> Also, replace snprintf by scnprintf, otherwise len
>> variable is incremented incorrectly. It is now
>> incremented by the actual character count written
>> in buf.
>>      v2: Replace snprintf by scnprintf
> 
> this should be below --- not to be the part of commit message.
> 
> M

Do you mean the last line v2: Replace snprintf by scnprintf ?

Francois


More information about the U-Boot mailing list