]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Adjust cut-off condition to correctly return INT_MAX for large integers.
authorJoerg Sonnenberger <joerg.sonnenberger@gmail.com>
Sun, 5 Dec 2010 00:54:03 +0000 (19:54 -0500)
committerJoerg Sonnenberger <joerg.sonnenberger@gmail.com>
Sun, 5 Dec 2010 00:54:03 +0000 (19:54 -0500)
Found by Maksymilian Arciemowicz <cxib@securityreason.com>.

SVN-Revision: 2810

libarchive/archive_acl.c

index d4195480b81e81c2f963c90f01a4c9441f96a745..54080b0ed576c69c9e7fb31207e72beb6d66bc05 100644 (file)
@@ -626,9 +626,10 @@ isint_w(const wchar_t *start, const wchar_t *end, int *result)
        while (start < end) {
                if (*start < '0' || *start > '9')
                        return (0);
-               if (n > (INT_MAX / 10))
+               if (n > (INT_MAX / 10) ||
+                   (n == INT_MAX / 10 && (*start - '0') > INT_MAX % 10)) {
                        n = INT_MAX;
-               else {
+               else {
                        n *= 10;
                        n += *start - '0';
                }