summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorcperciva <cperciva@FreeBSD.org>2008-08-04 06:53:13 +0000
committercperciva <cperciva@FreeBSD.org>2008-08-04 06:53:13 +0000
commitf33a169622381195f221b9372e38ab0a5ac83428 (patch)
treef2dfd90e02feb82d9892247db9b94f61bc150462 /lib
parent16fd05844bbb7394ac778ed5a036553d6536c18b (diff)
downloadFreeBSD-src-f33a169622381195f221b9372e38ab0a5ac83428.zip
FreeBSD-src-f33a169622381195f221b9372e38ab0a5ac83428.tar.gz
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
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/gen/getbsize.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/libc/gen/getbsize.c b/lib/libc/gen/getbsize.c
index 277eeb4..7e88e3f 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;
}
OpenPOWER on IntegriCloud