Subject: bin/12383: repquota has int overflow
To: None <gnats-bugs@gnats.netbsd.org>
From: None <mori@tri.asanuma.co.jp>
List: netbsd-bugs
Date: 03/12/2001 11:32:46
>Number:         12383
>Category:       bin
>Synopsis:       repquota has int overflow
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Mar 11 18:33:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Koji Mori
>Release:        NetBSD-1.5-release
>Organization:
Techinical Reserach Institute, Asanuma Corp., Takatsuki, Japan
>Environment:
	NetBSD-1.5/i386
System: NetBSD yashoda 1.5 NetBSD 1.5 (GENERIC) #2: Tue Dec 19 22:37:13 JST 2000 mori@shiva.tri.asanuma.co.jp:/u2/netbsd-1-5-RELEASE/src/sys/arch/i386/compile/GENERIC i386

>Description:
	I set user quota to 5GB, and show user quota with repquota(8).
	Then, soft/hard limits are very small.

	# quota -v mori
	Disk quotas for user tobita (uid 1006): 
	  Filesystem   blocks    quota    limit   grace   files   quota   limit   grace
	        /.u0  1980574  5000000  5000000            9983       0       0        
	# repquota /.u0
	Block limits               File limits
	User            used    soft    hard  grace    used  soft  hard  grace
	mori      -- 1980574  805696  805696           9983     0     0       

>How-To-Repeat:
	
>Fix:

--- repquota.c	2000/04/14 06:26:54	1.17
+++ repquota.c	2001/03/12 01:55:42
@@ -236,9 +236,9 @@
 			fup->fu_dqblk.dqb_isoftlimit &&
 			    fup->fu_dqblk.dqb_curinodes >=
 			    fup->fu_dqblk.dqb_isoftlimit ? '+' : '-',
-			dbtob(fup->fu_dqblk.dqb_curblocks) / 1024,
-			dbtob(fup->fu_dqblk.dqb_bsoftlimit) / 1024,
-			dbtob(fup->fu_dqblk.dqb_bhardlimit) / 1024,
+			(int)(dbtob((u_quad_t)fup->fu_dqblk.dqb_curblocks) / 1024),
+			(int)(dbtob((u_quad_t)fup->fu_dqblk.dqb_bsoftlimit) / 1024),
+			(int)(dbtob((u_quad_t)fup->fu_dqblk.dqb_bhardlimit) / 1024),
 			fup->fu_dqblk.dqb_bsoftlimit && 
 			    fup->fu_dqblk.dqb_curblocks >= 
 			    fup->fu_dqblk.dqb_bsoftlimit ?
>Release-Note:
>Audit-Trail:
>Unformatted: