[hackers] [sbase] Use SSIZE_MAX for overflow check in parseoffset() || sin

From: <git_AT_suckless.org>
Date: Thu, 26 Nov 2015 11:35:52 +0100 (CET)

commit 67157b7c4ea433f3a8dcbdfb5dbbc21108268852
Author: sin <sin_AT_2f30.org>
AuthorDate: Thu Nov 26 10:30:35 2015 +0000
Commit: sin <sin_AT_2f30.org>
CommitDate: Thu Nov 26 10:35:46 2015 +0000

    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.

diff --git a/libutil/parseoffset.c b/libutil/parseoffset.c
index 37673da..362a782 100644
--- a/libutil/parseoffset.c
+++ b/libutil/parseoffset.c
_AT_@ -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;
         }
Received on Thu Nov 26 2015 - 11:35:52 CET

This archive was generated by hypermail 2.3.0 : Thu Nov 26 2015 - 11:36:16 CET