[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6e390f96-b813-fcf8-f159-c22595b563a3@opensource.cirrus.com>
Date: Mon, 11 Jan 2021 10:37:59 +0000
From: Richard Fitzgerald <rf@...nsource.cirrus.com>
To: Petr Mladek <pmladek@...e.com>
CC: <rostedt@...dmis.org>, <sergey.senozhatsky@...il.com>,
<shuah@...nel.org>, <patches@...nsource.cirrus.com>,
<linux-kernel@...r.kernel.org>, <linux-kselftest@...r.kernel.org>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Rasmus Villemoes <linux@...musvillemoes.dk>
Subject: Re: [PATCH v3 1/4] lib: vsprintf: scanf: Negative number must have
field width > 1
On 11/01/2021 10:25, Petr Mladek wrote:
> Sigh, I have just realized that Andy and Rasmus, the other
> vsprintf maintainers and reviewers, were not in CC.
Sorry, probably my fault. I sent to the maintainers and lists reported
by get_maintainers.sh. I guess I missed that "reviewers" should also
be directly mailed.
> I am sorry for not noticing this earlier.
>
> The patchset is ready for 5.12 from my POV.
>
> Best Regards,
> Petr
>
> On Thu 2020-12-17 18:00:54, Richard Fitzgerald wrote:
>> If a signed number field starts with a '-' the field width must be > 1,
>> or unlimited, to allow at least one digit after the '-'.
>>
>> This patch adds a check for this. If a signed field starts with '-'
>> and field_width == 1 the scanf will quit.
>>
>> It is ok for a signed number field to have a field width of 1 if it
>> starts with a digit. In that case the single digit can be converted.
>>
>> Signed-off-by: Richard Fitzgerald <rf@...nsource.cirrus.com>
>> ---
>> lib/vsprintf.c | 6 +++++-
>> 1 file changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/lib/vsprintf.c b/lib/vsprintf.c
>> index 14c9a6af1b23..8954ff94a53c 100644
>> --- a/lib/vsprintf.c
>> +++ b/lib/vsprintf.c
>> @@ -3433,8 +3433,12 @@ int vsscanf(const char *buf, const char *fmt, va_list args)
>> str = skip_spaces(str);
>>
>> digit = *str;
>> - if (is_sign && digit == '-')
>> + if (is_sign && digit == '-') {
>> + if (field_width == 1)
>> + break;
>> +
>> digit = *(str + 1);
>> + }
>>
>> if (!digit
>> || (base == 16 && !isxdigit(digit))
>> --
>> 2.20.1
Powered by blists - more mailing lists