From 0f0ef228a5d198740c81433e6c8b32f1f6d50590 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Thu, 14 Feb 2013 16:34:13 -0500 Subject: [PATCH] If a line was longer that 0x80000000 the bit hack to round to the next power of two would roll over to zero. --- common/fileops.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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; -- 2.50.0