summaryrefslogtreecommitdiff
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 a592c2aea..f6294f90d 100644
--- a/scp.c
+++ b/scp.c
@@ -42,11 +42,11 @@ and ssh has the necessary privileges.)
42 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 42 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
43 * SUCH DAMAGE. 43 * SUCH DAMAGE.
44 * 44 *
45 * $Id: scp.c,v 1.2 1999/10/28 05:23:30 damien Exp $ 45 * $Id: scp.c,v 1.3 1999/11/11 01:25:14 damien Exp $
46 */ 46 */
47 47
48#include "includes.h" 48#include "includes.h"
49RCSID("$Id: scp.c,v 1.2 1999/10/28 05:23:30 damien Exp $"); 49RCSID("$Id: scp.c,v 1.3 1999/11/11 01:25:14 damien Exp $");
50 50
51#include "ssh.h" 51#include "ssh.h"
52#include "xmalloc.h" 52#include "xmalloc.h"
@@ -976,7 +976,7 @@ run_err(const char *fmt, ...)
976 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 976 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
977 * SUCH DAMAGE. 977 * SUCH DAMAGE.
978 * 978 *
979 * $Id: scp.c,v 1.2 1999/10/28 05:23:30 damien Exp $ 979 * $Id: scp.c,v 1.3 1999/11/11 01:25:14 damien Exp $
980 */ 980 */
981 981
982char * 982char *
@@ -1121,7 +1121,7 @@ progressmeter(int flag)
1121 struct timeval now, td, wait; 1121 struct timeval now, td, wait;
1122 off_t cursize, abbrevsize; 1122 off_t cursize, abbrevsize;
1123 double elapsed; 1123 double elapsed;
1124 int ratio, barlength, i, remaining; 1124 unsigned int ratio, barlength, i, remaining;
1125 char buf[256]; 1125 char buf[256];
1126 1126
1127 if (flag == -1) { 1127 if (flag == -1) {
@@ -1132,7 +1132,7 @@ progressmeter(int flag)
1132 (void)gettimeofday(&now, (struct timezone *)0); 1132 (void)gettimeofday(&now, (struct timezone *)0);
1133 cursize = statbytes; 1133 cursize = statbytes;
1134 if (totalbytes != 0) { 1134 if (totalbytes != 0) {
1135 ratio = cursize * 100 / totalbytes; 1135 ratio = (cursize >> 10) * 100 / (totalbytes >> 10);
1136 ratio = MAX(ratio, 0); 1136 ratio = MAX(ratio, 0);
1137 ratio = MIN(ratio, 100); 1137 ratio = MIN(ratio, 100);
1138 } 1138 }