]> andersk Git - openssh.git/commitdiff
- Merged OpenBSD CVS changes:
authordamien <damien>
Sat, 13 Nov 1999 02:22:46 +0000 (02:22 +0000)
committerdamien <damien>
Sat, 13 Nov 1999 02:22:46 +0000 (02:22 +0000)
   - [bufaux.c] save a view malloc/memcpy/memset/free's, ok niels
   - [scp.c] fix overflow reported by damien@ibs.com.au: off_t
     totalsize, ok niels,aaron

bufaux.c
scp.c

index 7f92245f44612eb4715fb5c44b879c66457b198c..4e8e0eec7ff3ec31bea63f0239365b982a76e4ea 100644 (file)
--- a/bufaux.c
+++ b/bufaux.c
@@ -71,10 +71,11 @@ buffer_get_bignum(Buffer *buffer, BIGNUM *value)
   bits = GET_16BIT(buf);
   /* Compute the number of binary bytes that follow. */
   bytes = (bits + 7) / 8;
-  bin = xmalloc(bytes);
-  buffer_get(buffer, bin, bytes);
+  if (buffer_len(buffer) < bytes)
+    fatal("buffer_get_bignum: input buffer too small");
+  bin = buffer_ptr(buffer);
   BN_bin2bn(bin, bytes, value);
-  xfree(bin);
+  buffer_consume(buffer, bytes);
 
   return 2 + bytes;
 }
diff --git a/scp.c b/scp.c
index a079d28ef4ddbd9bad0ad511f29657fd12ba1109..34f848e14743620dc4daa7243ef9e851fe386984 100644 (file)
--- a/scp.c
+++ b/scp.c
@@ -70,7 +70,7 @@ static struct timeval start;
 volatile unsigned long statbytes;
 
 /* Total size of current file. */
-unsigned long totalbytes = 0;
+off_t totalbytes = 0;
 
 /* Name of current file being transferred. */
 char *curfile;
@@ -1131,8 +1131,8 @@ progressmeter(int flag)
        }   
        (void)gettimeofday(&now, (struct timezone *)0);
        cursize = statbytes;
-       if ((totalbytes >> 10) != 0) {
-               ratio = (cursize >> 10) * 100 / (totalbytes >> 10);
+       if (totalbytes != 0) {
+               ratio = cursize * 100 / totalbytes;
                ratio = MAX(ratio, 0);
                ratio = MIN(ratio, 100);
        }
This page took 0.056743 seconds and 5 git commands to generate.