diff options
author | cperciva <cperciva@FreeBSD.org> | 2008-08-04 06:53:13 +0000 |
---|---|---|
committer | cperciva <cperciva@FreeBSD.org> | 2008-08-04 06:53:13 +0000 |
commit | f33a169622381195f221b9372e38ab0a5ac83428 (patch) | |
tree | f2dfd90e02feb82d9892247db9b94f61bc150462 /lib/libc | |
parent | 16fd05844bbb7394ac778ed5a036553d6536c18b (diff) | |
download | FreeBSD-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/libc')
-rw-r--r-- | lib/libc/gen/getbsize.c | 1 |
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; } |