ps: swat insidious bug with the %cpu' format specifier
authorJim Warner <james.warner@comcast.net>
Wed, 9 Mar 2022 06:00:00 +0000 (00:00 -0600)
committerCraig Small <csmall@dropbear.xyz>
Tue, 15 Mar 2022 11:13:44 +0000 (22:13 +1100)
commit05187e4f17fec226ca60595a7558f9a34750efb0
tree382b24f85f1f57da1dbe51e69d02f1687f438945
parent204194cdc414df177f49372783b604c8d43763da
ps: swat insidious bug with the %cpu' format specifier

[ the original newlib commit message(s) appear below ]

----------------------------------------- newlib patch
ps: swat insidious bug with the %cpu' format specifier

Whoa, my head really hurts but this commit should help
with a speedy recovery hopefully, after it is applied.

If the '%cpu' field is used as a format specifier with
that 'o' option, you will encounter a SIGSEGV if there
is also an invalid argument on that same command line.

For example, try 'ps/pscommand -o %cpu,x' with newlib.
With any format specifier other than the '%cpu', there
is an error message, as would happen with '-o pcpu,x'.

For a 3.3.17 version of ps, there's no abend. Instead,
the program will just display a bunch of gobbledygook.
This boo-boo was found to exist as far back as v3.3.0.

[ ok, i am starting to feel very much better already ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
ps/sortformat.c