From cb8330d03640ba3511e15adf39d23d2eaf25dae7 Mon Sep 17 00:00:00 2001 From: Colin Percival Date: Mon, 4 Aug 2008 06:53:13 +0000 Subject: [PATCH] Set "max" to a reasonable value if BLOCKSIZE has a bogus unit. Prior to this commit, "env BLOCKSIZE=4X df" prints not only "4X: unknown blocksize" as expected, but sometimes also "maximum blocksize is 1G" and "minimum blocksize is 512" depending on what happened to be on the stack. Found by: LLVM/Clang Static Checker --- lib/libc/gen/getbsize.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/libc/gen/getbsize.c b/lib/libc/gen/getbsize.c index 277eeb454ae..7e88e3ff176 100644 --- a/lib/libc/gen/getbsize.c +++ b/lib/libc/gen/getbsize.c @@ -83,6 +83,7 @@ getbsize(headerlenp, blocksizep) default: fmterr: warnx("%s: unknown blocksize", p); n = 512; + max = MAXB; mul = 1; break; }