From: Todd C. Miller Date: Thu, 14 Feb 2013 21:34:13 +0000 (-0500) Subject: If a line was longer that 0x80000000 the bit hack to round to the X-Git-Tag: SUDO_1_8_7~1^2~229 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0f0ef228a5d198740c81433e6c8b32f1f6d50590;p=sudo If a line was longer that 0x80000000 the bit hack to round to the next power of two would roll over to zero. --- diff --git a/common/fileops.c b/common/fileops.c index e06b82cdd..577bf10a4 100644 --- a/common/fileops.c +++ b/common/fileops.c @@ -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;