From 67157b7c4ea433f3a8dcbdfb5dbbc21108268852 Mon Sep 17 00:00:00 2001 From: sin Date: Thu, 26 Nov 2015 10:30:35 +0000 Subject: [PATCH] Use SSIZE_MAX for overflow check in parseoffset() There's no such thing as OFF_MAX so we can't use that. off_t is signed, so use SSIZE_MAX which will typically match the range of off_t. --- libutil/parseoffset.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libutil/parseoffset.c b/libutil/parseoffset.c index 37673da..362a782 100644 --- a/libutil/parseoffset.c +++ b/libutil/parseoffset.c @@ -52,7 +52,7 @@ parseoffset(const char *str) } /* prevent overflow */ - if (res > (SIZE_MAX / scale)) { + if (res > (SSIZE_MAX / scale)) { weprintf("parseoffset %s: out of range\n", str); return -1; }