aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/quot
diff options
context:
space:
mode:
authorMatthew Dillon <dillon@FreeBSD.org>1998-12-13 07:16:05 +0000
committerMatthew Dillon <dillon@FreeBSD.org>1998-12-13 07:16:05 +0000
commit9983067ebe85d0606b5e55f2b9c3b74947565f65 (patch)
tree86c2a6fab35746bd211be1f36ecab2c1b3e98f08 /usr.sbin/quot
parent65de0c7a93cadd3cc62506d1836e93b0eff92d0a (diff)
downloadsrc-9983067ebe85d0606b5e55f2b9c3b74947565f65.tar.gz
src-9983067ebe85d0606b5e55f2b9c3b74947565f65.zip
Notes
Diffstat (limited to 'usr.sbin/quot')
-rw-r--r--usr.sbin/quot/quot.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/usr.sbin/quot/quot.c b/usr.sbin/quot/quot.c
index 7be0641814da..547fd8fd8637 100644
--- a/usr.sbin/quot/quot.c
+++ b/usr.sbin/quot/quot.c
@@ -31,7 +31,7 @@
#ifndef lint
static const char rcsid[] =
- "$Id: quot.c,v 1.7 1997/10/10 06:31:07 charnier Exp $";
+ "$Id: quot.c,v 1.8 1998/01/17 16:45:03 bde Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -66,11 +66,14 @@ static int headerlen;
* The new code always counts the number of 512 byte blocks
* instead of the number of kilobytes and converts them to
* kByte when done (on request).
+ *
+ * Due to the size of modern disks, we must cast intermediate
+ * values to 64 bits to prevent potential overflows.
*/
#ifdef COMPAT
#define SIZE(n) (n)
#else
-#define SIZE(n) (((n) * 512 + blocksize - 1)/blocksize)
+#define SIZE(n) ((int)(((quad_t)(n) * 512 + blocksize - 1)/blocksize))
#endif
#define INOCNT(fs) ((fs)->fs_ipg)