]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
- Merged OpenBSD CVS changes:
authorDamien Miller <djm@mindrot.org>
Sat, 13 Nov 1999 02:22:46 +0000 (13:22 +1100)
committerDamien Miller <djm@mindrot.org>
Sat, 13 Nov 1999 02:22:46 +0000 (13:22 +1100)
   - [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 1e27e7350a3932bbcd20aec729450a73ee2ff5f0..a1ba0fd58df0e13c56fb2136802d8de0e73253dd 100644 (file)
--- a/bufaux.c
+++ b/bufaux.c
@@ -15,7 +15,7 @@ Buffers.
 */
 
 #include "includes.h"
-RCSID("$Id: bufaux.c,v 1.4 1999/11/12 23:51:58 damien Exp $");
+RCSID("$Id: bufaux.c,v 1.5 1999/11/13 02:22:46 damien Exp $");
 
 #include "ssh.h"
 
@@ -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 95160e81facc049c61e9fd23c92f5b6ba10a7e27..2850f76fadd77b52d2bc9a5f5bddfe544cb44f1b 100644 (file)
--- 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.5 1999/11/12 05:28:02 damien Exp $
+ *     $Id: scp.c,v 1.6 1999/11/13 02:22:46 damien Exp $
  */
 
 #include "includes.h"
-RCSID("$Id: scp.c,v 1.5 1999/11/12 05:28:02 damien Exp $");
+RCSID("$Id: scp.c,v 1.6 1999/11/13 02:22:46 damien Exp $");
 
 #include "ssh.h"
 #include "xmalloc.h"
@@ -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;
@@ -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.5 1999/11/12 05:28:02 damien Exp $
+ *     $Id: scp.c,v 1.6 1999/11/13 02:22:46 damien Exp $
  */
 
 char *
@@ -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);
        }