Bug is reproducible in TeraTerm 4.83 (and IMO is in the current trunk too)
According to the YMODEM standard, the sending program may leave out
the additional file info (for example, the file length) if it doesn't
know it, for example if the sending side does something like this:
ls -l | sz --ymodem -
In that case, the lsz program is called in YMODEM mode and told to send
its standard input (which is the output of a directory listing). Thus, it
can't know in advance the file length. As per YMODEM standard, only the
filename is set in the header packet, and the remaining bytes stay ASCII NULs.
In that case, the YReadPacket() function fails:
if (*nameend) {
ret = sscanf(nameend, "%ld%lo%o", &bytes_total, &modtime, &mode);
if (ret >= 1) {
fv->FileSize = bytes_total;
}
if (ret >= 2) {
fv->FileMtime = modtime;
}
}
--> since nameend points to an ASCII NUL, the fv->FileSize will stay 0
Bug is reproducible in TeraTerm 4.83 (and IMO is in the current trunk too)
According to the YMODEM standard, the sending program may leave out the additional file info (for example, the file length) if it doesn't know it, for example if the sending side does something like this:
In that case, the lsz program is called in YMODEM mode and told to send its standard input (which is the output of a directory listing). Thus, it can't know in advance the file length. As per YMODEM standard, only the filename is set in the header packet, and the remaining bytes stay ASCII NULs.
In that case, the YReadPacket() function fails:
if (*nameend) { ret = sscanf(nameend, "%ld%lo%o", &bytes_total, &modtime, &mode); if (ret >= 1) { fv->FileSize = bytes_total; } if (ret >= 2) { fv->FileMtime = modtime; } }
if (fv->ByteCount + c > fv->FileSize) { c = fv->FileSize - fv->ByteCount; }
if (yv->TextFlag>0)
else _lwrite(fv->FileHandle, &(yv->PktIn3), c);
This code should be changed to leave out the filesize check if (fv->FileSize == 0)...