View | Details | Raw Unified | Return to bug 1192 | Differences between
and this patch

Collapse All | Expand All

(-)scp.c (-2 / +7 lines)
Lines 607-613 Link Here
607
	struct stat stb;
607
	struct stat stb;
608
	static BUF buffer;
608
	static BUF buffer;
609
	BUF *bp;
609
	BUF *bp;
610
	off_t i, amt, statbytes;
610
	off_t i, statbytes;
611
	size_t amt;
611
	int fd = -1, haderr, indx;
612
	int fd = -1, haderr, indx;
612
	char *last, *name, buf[2048], encname[MAXPATHLEN];
613
	char *last, *name, buf[2048], encname[MAXPATHLEN];
613
	int len;
614
	int len;
Lines 628-633 Link Here
628
syserr:			run_err("%s: %s", name, strerror(errno));
629
syserr:			run_err("%s: %s", name, strerror(errno));
629
			goto next;
630
			goto next;
630
		}
631
		}
632
		if (stb.st_size < 0) {
633
			run_err("%s: %s", name, "Negative file size");
634
			goto next;
635
		}
631
		unset_nonblock(fd);
636
		unset_nonblock(fd);
632
		switch (stb.st_mode & S_IFMT) {
637
		switch (stb.st_mode & S_IFMT) {
633
		case S_IFREG:
638
		case S_IFREG:
Lines 687-693 Link Here
687
		set_nonblock(remout);
692
		set_nonblock(remout);
688
		for (haderr = i = 0; i < stb.st_size; i += bp->cnt) {
693
		for (haderr = i = 0; i < stb.st_size; i += bp->cnt) {
689
			amt = bp->cnt;
694
			amt = bp->cnt;
690
			if (i + amt > stb.st_size)
695
			if (i + (off_t)amt > stb.st_size)
691
				amt = stb.st_size - i;
696
				amt = stb.st_size - i;
692
			if (!haderr) {
697
			if (!haderr) {
693
				if (atomicio(read, fd, bp->buf, amt) != amt)
698
				if (atomicio(read, fd, bp->buf, amt) != amt)

Return to bug 1192