Opened 12 years ago

Closed 7 years ago

#8277 closed Bug report (outdated)

Filezilla sftp download is not handling EOF properly

Reported by: Juan J. Martinez Owned by:
Priority: normal Component: FileZilla Client
Keywords: sftp, eof Cc:
Component version: Operating system type: Linux
Operating system version: Ubuntu 12.04

Description

Filezilla 3.5.3.

When downloading a file using SFTP, the EOF is not handled properly.

Example: downloading a 1564 bytes file.

  • stat: server returns size 1564
  • open
  • read offset 0, len 32768: server returns 1564 data (as expected)

Now starts the stuff I think is not correct:

  • read offset 32768, 32768: server returns EOF (issue 1: offset should be 1564, issue 2: the transfer should stop here)

And now keeps going up to 1 MB:

  • read offset 65536, 32768: server returns EOF
  • read offset 98304, 32768: server returns EOF
  • ...
  • read offset 1048576, 32768: server returns EOF
  • close

About issue 1, I haven't found where's the problem. The offset of the request should always be adjusted to rr->retlen.

About issue 2, checking trunk/src/putty/sftp.c:1259, in xfer_download_gotpkt:

1273 	if ((rr->retlen < 0 && fxp_error_type()==SSH_FX_EOF) || rr->retlen == 0) {
1274 	xfer->eof = TRUE;
1275 	rr->complete = -1;
1276 	#ifdef DEBUG_DOWNLOAD
1277 	printf("setting eof\n");
1278 	#endif
1279 	} else if (rr->retlen < 0) {
1280 	/* some error other than EOF; signal it back to caller */
1281 	xfer_set_error(xfer);
1282 	rr->complete = -1;
1283 	return -1;
1284 	}
1285 	
1286 	rr->complete = 1;

So rr->complete is set to -1 when EOF is detected, but then that it's ignored and set to 1. I believe a return 1 is missing after setting complete to -1.

Change History (2)

comment:1 by Tim Kosse, 12 years ago

Status: newmoreinfo

Does this problem also exist in the latest PuTTY development snapshot? See http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html

If so, please report this problem to the PuTTY developers. Once it has been fixed upstream, we can backport the fix to FileZilla.

comment:2 by Kurt McKee, 7 years ago

Resolution: outdated
Status: moreinfoclosed
Note: See TracTickets for help on using tickets.