[LTP] [PATCH v2] tst_kconfig: Avoid reporting buffer overflow when parsing /proc/cmdline

Li Wang liwang@redhat.com
Fri Jun 21 11:12:23 CEST 2024


Hi All,

Li Wang <liwang@redhat.com> wrote:


> > > diff --git a/lib/tst_kconfig.c b/lib/tst_kconfig.c
>> > > index e16ca1400..8eb1b803f 100644
>> > > --- a/lib/tst_kconfig.c
>> > > +++ b/lib/tst_kconfig.c
>> > > @@ -569,7 +569,7 @@ char tst_kconfig_get(const char *confname)
>>
>> > >  void tst_kcmdline_parse(struct tst_kcmdline_var params[], size_t
>> > > params_len)
>> > >  {
>> > > -       char buf[128], line[512];
>> > > +       char buf[256], line[512];
>>
>>
>> > Petr, if you are still worried, feel free to enlarge them to char
>> > 'buf[512], line[2048];' during merge :).
>>
>> Li, I'm ok with 256 :).
>> Reviewed-by: Petr Vorel <pvorel@suse.cz>
>>
>
> Thanks.
>
>
>> -                               tst_res(TWARN, "Buffer overflowed while
>> parsing /proc/cmdline");
>> +                               tst_res(TINFO, "Buffer overflowed while
>> parsing /proc/cmdline");
>>
>>
>
>> But I wonder if we should keep TWARN. Or at least add
>> +                               tst_res(TINFO, "WARNING: Buffer
>> overflowed while parsing /proc/cmdline");
>>
>
> +1, I'd merge like this if Cyril has no more comments.
>

I dared to merge this patch to avoid annoying our engineers with this
little WARNING issue.
Thanks!

-- 
Regards,
Li Wang


More information about the ltp mailing list