summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorjmallett <jmallett@FreeBSD.org>2002-06-06 20:29:39 +0000
committerjmallett <jmallett@FreeBSD.org>2002-06-06 20:29:39 +0000
commit7916563c61a5931e66cab9f19c248a037a3b256d (patch)
tree0ae812c2fc0bd427e8ba45de5b0352b4a177b0c4 /bin
parent562b4c02507bd0c452d9229307892f9c41a9c555 (diff)
downloadFreeBSD-src-7916563c61a5931e66cab9f19c248a037a3b256d.zip
FreeBSD-src-7916563c61a5931e66cab9f19c248a037a3b256d.tar.gz
Cast arg_max to size_t when comparing it (times 4, plus 1) against SIZE_MAX. I
was worried about truncation of arg_max by this cast, but if it gets truncated, we know it'll obviously be greater than SIZE_MAX anyway. Big pointy hat to: jmallett Submitted by: keramida
Diffstat (limited to 'bin')
-rw-r--r--bin/ps/fmt.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/bin/ps/fmt.c b/bin/ps/fmt.c
index 9263886..3703ace 100644
--- a/bin/ps/fmt.c
+++ b/bin/ps/fmt.c
@@ -70,7 +70,8 @@ shquote(char **argv)
if (buf == NULL) {
if ((arg_max = sysconf(_SC_ARG_MAX)) == -1)
errx(1, "sysconf _SC_ARG_MAX failed");
- if (arg_max >= LONG_MAX / 4 || 4 * arg_max + 1 > SIZE_MAX)
+ if (arg_max >= LONG_MAX / 4 ||
+ 4 * (size_t)arg_max + 1 > SIZE_MAX)
errx(1, "sysconf _SC_ARG_MAX preposterously large");
buf_size = 4 * arg_max + 1;
if ((buf = malloc(buf_size)) == NULL)
OpenPOWER on IntegriCloud