Re: [PATCH] lib/cmdline: prevent unintented access to address

From: Andy Shevchenko
Date: Wed Aug 12 2020 - 05:24:44 EST


On Wed, Aug 12, 2020 at 11:54:02AM +0900, Seungil Kang wrote:

Thanks for the patch, my comments below.

> When args = "\"\0", "i" will be 0 and args[i-1] is used (line:238)

Can you be less ambiguous with the args value? (Perhaps provide a hexdump of it
for better understanding)

> Because of "i" is an unsigned int type,
> the function will access at args[0xFFFFFFFF]
> It can make a crash

Please, use proper punctuation, I'm lost where is the sentence and what are the
logical parts of them.

Can you point out to the code that calls this and leads to a crash?

> lib/cmdline.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)

Can you provide a KUnit test module which can check the case?

--
With Best Regards,
Andy Shevchenko