summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>1999-11-11 12:25:14 +1100
committerDamien Miller <djm@mindrot.org>1999-11-11 12:25:14 +1100
commit634bf647af3ed8f2c0afbd6adbf2f1ba773bbd25 (patch)
tree37be94a59daa72c1a282287f36bee4afe3766367
parent33e511edb33a5c17e088b5475191c46650e1692d (diff)
Fixed interger overflow in progress meter for large files
-rw-r--r--scp.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/scp.c b/scp.c
index a592c2ae..f6294f90 100644
--- a/scp.c
+++ b/scp.c
@@ -42,11 +42,11 @@ and ssh has the necessary privileges.)
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: scp.c,v 1.2 1999/10/28 05:23:30 damien Exp $
+ * $Id: scp.c,v 1.3 1999/11/11 01:25:14 damien Exp $
*/
#include "includes.h"
-RCSID("$Id: scp.c,v 1.2 1999/10/28 05:23:30 damien Exp $");
+RCSID("$Id: scp.c,v 1.3 1999/11/11 01:25:14 damien Exp $");
#include "ssh.h"
#include "xmalloc.h"
@@ -976,7 +976,7 @@ run_err(const char *fmt, ...)
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: scp.c,v 1.2 1999/10/28 05:23:30 damien Exp $
+ * $Id: scp.c,v 1.3 1999/11/11 01:25:14 damien Exp $
*/
char *
@@ -1121,7 +1121,7 @@ progressmeter(int flag)
struct timeval now, td, wait;
off_t cursize, abbrevsize;
double elapsed;
- int ratio, barlength, i, remaining;
+ unsigned int ratio, barlength, i, remaining;
char buf[256];
if (flag == -1) {
@@ -1132,7 +1132,7 @@ progressmeter(int flag)
(void)gettimeofday(&now, (struct timezone *)0);
cursize = statbytes;
if (totalbytes != 0) {
- ratio = cursize * 100 / totalbytes;
+ ratio = (cursize >> 10) * 100 / (totalbytes >> 10);
ratio = MAX(ratio, 0);
ratio = MIN(ratio, 100);
}