]> granicus.if.org Git - procps-ng/commit
0032-proc/sig.c: Fix the strtosig() function.
authorQualys Security Advisory <qsa@qualys.com>
Thu, 1 Jan 1970 00:00:00 +0000 (00:00 +0000)
committerCraig Small <csmall@enc.com.au>
Sat, 9 Jun 2018 11:35:19 +0000 (21:35 +1000)
commit50b343e06867169c0b1548deb75fbd36003dcdaf
tree8845d2c23d508d7cbc51a7e58c98da502abd4fab
parentef03c8944789a151c83433848c4929c8b1034cce
0032-proc/sig.c: Fix the strtosig() function.

Do not memleak "copy" in case of an error.

Do not use "sizeof(converted)" in snprintf(), since "converted" is a
"char *" (luckily, 8 >= sizeof(char *)). Also, remove "sizeof(char)"
which is guaranteed to be 1 by the C standard, and replace 8 with 12,
which is enough to hold any stringified int and does not consume more
memory (in both cases, the glibc malloc()ates a minimum-sized chunk).

---------------------------- adapted for newlib branch
. no longer in library, logic  now found in lib/signals.c
. craig already addressed "copy" memleak in commit beloww

Reference(s):
commit d2df396ba9bff2180af1233f65ca68342c35fed0

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