[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2024070413-obsessive-stack-7c62@gregkh>
Date: Thu, 4 Jul 2024 12:07:47 +0200
From: Greg KH <gregkh@...uxfoundation.org>
To: tuhaowen <tuhaowen@...ontech.com>
Cc: sudipm.mukherjee@...il.com, alexander.deucher@....com,
linux-kernel@...r.kernel.org, huangbibo@...ontech.com,
wangyuli@...ontech.com
Subject: Re: [PATCH] dev/parport: fix the array out-of-bounds risk
On Wed, Jun 26, 2024 at 10:11:36AM +0800, tuhaowen wrote:
> The array buffer size is 20 bytes.
> When executing code in a 64-bit CPU environment, up to 42 bytes of
> data will be written into this array
> (the size of "%lu\t%lu\n" is 20 + 1 + 20 + 1).
>
> In fact, this line of code for 32-bit CPUs also has the risk of
> crossing the boundary, but it can exceed 2 bytes at most. With good
> luck, it is local variables that are damaged, and there are no serious
> consequences.
Usually because no one actually has this hardware anymore :)
Can you also properly test the buffer size when writing into it so that
even if the math is incorrect, it will not overflow?
thanks,
greg k-h
Powered by blists - more mailing lists