]> granicus.if.org Git - sudo/commitdiff
If a line was longer that 0x80000000 the bit hack to round to the
authorTodd C. Miller <Todd.Miller@courtesan.com>
Thu, 14 Feb 2013 21:34:13 +0000 (16:34 -0500)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Thu, 14 Feb 2013 21:34:13 +0000 (16:34 -0500)
next power of two would roll over to zero.

common/fileops.c

index e06b82cddd4946e9a1beb4c0483e23b5bb43773e..577bf10a4e2d8be70bfe76445ce04ee1575da916 100644 (file)
@@ -204,11 +204,11 @@ sudo_parseln(char **bufp, size_t *bufsizep, unsigned int *lineno, FILE *fp)
 
        if (*bufp == NULL || total + len >= *bufsizep) {
            void *tmp;
-           unsigned int size = total + len + 1;
+           size_t size = total + len + 1;
 
            if (size < 64) {
                size = 64;
-           } else {
+           } else if (size <= 0x80000000) {
                /* Round up to next highest power of two. */
                size--;
                size |= size >> 1;