[procps] Re: a few more patches

  • From: Jim Warner <james.warner@xxxxxxxxxxx>
  • To: Procps-ng Mail list <procps@xxxxxxxxxxxxx>
  • Date: Thu, 17 Feb 2022 03:48:29 -0600

On 2/17/22 1:47 AM, Craig Small wrote:

I can't find an email if I gave specifics about the warnings or not, but they are below.

This seems a bit of a bogus warning. You are using snprintf() with a %s which could be a long string and limiting it to 4 characters.
The issue is, not checking the return value. But! you know what the source string is (another window name) so it won't be larger than 4 and truncate.

There are probably three ways ahead with this:
  * Disable the warning when using --enable-harden-flags
  * Add a compiler note to not complain
  * Change the top.c code to check the return value

I see not a lot of value of this warning, especially in this context; what's your view?

Hi Craig,

I can't generate this warning no matter what options or CFLAGS I use.

My gcc is 11.2.0.

What's yours?

Regards,

Jim

Other related posts: