From 9062704bf8d3b75f73272bb2a8d6539568933e57 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 17 Sep 2022 19:41:15 -0700 Subject: [PATCH] kill: port to picky-conversion hosts MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit * src/kill.c (send_signals): Don’t rely on conversion overflow being silent. --- src/kill.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/kill.c b/src/kill.c index be01b2bf4c..33e602dcdc 100644 --- a/src/kill.c +++ b/src/kill.c @@ -199,9 +199,10 @@ send_signals (int signum, char *const *argv) { char *endp; intmax_t n = (errno = 0, strtoimax (arg, &endp, 10)); - pid_t pid = n; + pid_t pid; - if (errno == ERANGE || pid != n || arg == endp || *endp) + if (errno == ERANGE || INT_ADD_WRAPV (n, 0, &pid) + || arg == endp || *endp) { error (0, 0, _("%s: invalid process id"), quote (arg)); status = EXIT_FAILURE; -- 2.47.2