summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bufaux.c9
-rw-r--r--scp.c12
2 files changed, 11 insertions, 10 deletions
diff --git a/bufaux.c b/bufaux.c
index 1e27e7350..a1ba0fd58 100644
--- a/bufaux.c
+++ b/bufaux.c
@@ -15,7 +15,7 @@ Buffers.
15*/ 15*/
16 16
17#include "includes.h" 17#include "includes.h"
18RCSID("$Id: bufaux.c,v 1.4 1999/11/12 23:51:58 damien Exp $"); 18RCSID("$Id: bufaux.c,v 1.5 1999/11/13 02:22:46 damien Exp $");
19 19
20#include "ssh.h" 20#include "ssh.h"
21 21
@@ -71,10 +71,11 @@ buffer_get_bignum(Buffer *buffer, BIGNUM *value)
71 bits = GET_16BIT(buf); 71 bits = GET_16BIT(buf);
72 /* Compute the number of binary bytes that follow. */ 72 /* Compute the number of binary bytes that follow. */
73 bytes = (bits + 7) / 8; 73 bytes = (bits + 7) / 8;
74 bin = xmalloc(bytes); 74 if (buffer_len(buffer) < bytes)
75 buffer_get(buffer, bin, bytes); 75 fatal("buffer_get_bignum: input buffer too small");
76 bin = buffer_ptr(buffer);
76 BN_bin2bn(bin, bytes, value); 77 BN_bin2bn(bin, bytes, value);
77 xfree(bin); 78 buffer_consume(buffer, bytes);
78 79
79 return 2 + bytes; 80 return 2 + bytes;
80} 81}
diff --git a/scp.c b/scp.c
index 95160e81f..2850f76fa 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.5 1999/11/12 05:28:02 damien Exp $ 45 * $Id: scp.c,v 1.6 1999/11/13 02:22:46 damien Exp $
46 */ 46 */
47 47
48#include "includes.h" 48#include "includes.h"
49RCSID("$Id: scp.c,v 1.5 1999/11/12 05:28:02 damien Exp $"); 49RCSID("$Id: scp.c,v 1.6 1999/11/13 02:22:46 damien Exp $");
50 50
51#include "ssh.h" 51#include "ssh.h"
52#include "xmalloc.h" 52#include "xmalloc.h"
@@ -70,7 +70,7 @@ static struct timeval start;
70volatile unsigned long statbytes; 70volatile unsigned long statbytes;
71 71
72/* Total size of current file. */ 72/* Total size of current file. */
73unsigned long totalbytes = 0; 73off_t totalbytes = 0;
74 74
75/* Name of current file being transferred. */ 75/* Name of current file being transferred. */
76char *curfile; 76char *curfile;
@@ -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.5 1999/11/12 05:28:02 damien Exp $ 979 * $Id: scp.c,v 1.6 1999/11/13 02:22:46 damien Exp $
980 */ 980 */
981 981
982char * 982char *
@@ -1131,8 +1131,8 @@ progressmeter(int flag)
1131 } 1131 }
1132 (void)gettimeofday(&now, (struct timezone *)0); 1132 (void)gettimeofday(&now, (struct timezone *)0);
1133 cursize = statbytes; 1133 cursize = statbytes;
1134 if ((totalbytes >> 10) != 0) { 1134 if (totalbytes != 0) {
1135 ratio = (cursize >> 10) * 100 / (totalbytes >> 10); 1135 ratio = cursize * 100 / totalbytes;
1136 ratio = MAX(ratio, 0); 1136 ratio = MAX(ratio, 0);
1137 ratio = MIN(ratio, 100); 1137 ratio = MIN(ratio, 100);
1138 } 1138 }