summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2008-06-14 09:02:25 +1000
committerDarren Tucker <dtucker@zip.com.au>2008-06-14 09:02:25 +1000
commit03ccc9b142519ac8167951fac27d977dc280b79a (patch)
treef553fd300f65d75275d218a58f13518457f64636
parent47e713be94464b6ed7be0186e79c3f7b73f99936 (diff)
- dtucker@cvs.openbsd.org 2008/06/13 18:55:22
[scp.c] Prevent -Wsign-compare warnings on LP64 systems. bz #1192, ok deraadt@
-rw-r--r--ChangeLog5
-rw-r--r--scp.c11
2 files changed, 12 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 0b7387c56..7279a819f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -15,6 +15,9 @@
15 - dtucker@cvs.openbsd.org 2008/06/13 17:21:20 15 - dtucker@cvs.openbsd.org 2008/06/13 17:21:20
16 [mux.c] 16 [mux.c]
17 Friendlier error messages for mux fallback. ok djm@ 17 Friendlier error messages for mux fallback. ok djm@
18 - dtucker@cvs.openbsd.org 2008/06/13 18:55:22
19 [scp.c]
20 Prevent -Wsign-compare warnings on LP64 systems. bz #1192, ok deraadt@
18 21
1920080612 2220080612
20 - (dtucker) OpenBSD CVS Sync 23 - (dtucker) OpenBSD CVS Sync
@@ -4353,4 +4356,4 @@
4353 OpenServer 6 and add osr5bigcrypt support so when someone migrates 4356 OpenServer 6 and add osr5bigcrypt support so when someone migrates
4354 passwords between UnixWare and OpenServer they will still work. OK dtucker@ 4357 passwords between UnixWare and OpenServer they will still work. OK dtucker@
4355 4358
4356$Id: ChangeLog,v 1.5007 2008/06/13 23:01:54 dtucker Exp $ 4359$Id: ChangeLog,v 1.5008 2008/06/13 23:02:25 dtucker Exp $
diff --git a/scp.c b/scp.c
index c047864aa..46433a638 100644
--- a/scp.c
+++ b/scp.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: scp.c,v 1.162 2008/01/01 09:06:39 dtucker Exp $ */ 1/* $OpenBSD: scp.c,v 1.163 2008/06/13 18:55:22 dtucker Exp $ */
2/* 2/*
3 * scp - secure remote copy. This is basically patched BSD rcp which 3 * scp - secure remote copy. This is basically patched BSD rcp which
4 * uses ssh to do the data transfer (instead of using rcmd). 4 * uses ssh to do the data transfer (instead of using rcmd).
@@ -629,7 +629,8 @@ source(int argc, char **argv)
629 struct stat stb; 629 struct stat stb;
630 static BUF buffer; 630 static BUF buffer;
631 BUF *bp; 631 BUF *bp;
632 off_t i, amt, statbytes; 632 off_t i, statbytes;
633 size_t amt;
633 int fd = -1, haderr, indx; 634 int fd = -1, haderr, indx;
634 char *last, *name, buf[2048], encname[MAXPATHLEN]; 635 char *last, *name, buf[2048], encname[MAXPATHLEN];
635 int len; 636 int len;
@@ -650,6 +651,10 @@ source(int argc, char **argv)
650syserr: run_err("%s: %s", name, strerror(errno)); 651syserr: run_err("%s: %s", name, strerror(errno));
651 goto next; 652 goto next;
652 } 653 }
654 if (stb.st_size < 0) {
655 run_err("%s: %s", name, "Negative file size");
656 goto next;
657 }
653 unset_nonblock(fd); 658 unset_nonblock(fd);
654 switch (stb.st_mode & S_IFMT) { 659 switch (stb.st_mode & S_IFMT) {
655 case S_IFREG: 660 case S_IFREG:
@@ -709,7 +714,7 @@ next: if (fd != -1) {
709 set_nonblock(remout); 714 set_nonblock(remout);
710 for (haderr = i = 0; i < stb.st_size; i += bp->cnt) { 715 for (haderr = i = 0; i < stb.st_size; i += bp->cnt) {
711 amt = bp->cnt; 716 amt = bp->cnt;
712 if (i + amt > stb.st_size) 717 if (i + (off_t)amt > stb.st_size)
713 amt = stb.st_size - i; 718 amt = stb.st_size - i;
714 if (!haderr) { 719 if (!haderr) {
715 if (atomicio(read, fd, bp->buf, amt) != amt) 720 if (atomicio(read, fd, bp->buf, amt) != amt)