mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-11-17 07:05:31 +08:00
[Bug] [ymodem] last frame's data_sz issue, fixed.
This commit is contained in:
1 parent
43a727691d
commit
85bd74640e
1 file changed
+4
-4
@@ -500,8 +500,8 @@ static rt_err_t _rym_do_fin(struct rym_ctx *ctx)
|
||||
else
|
||||
return -RYM_ERR_CODE;
|
||||
|
||||
i = _rym_read_data(ctx, _RYM_SOH_PKG_SZ - 1);
|
||||
if (i != (_RYM_SOH_PKG_SZ - 1))
|
||||
i = _rym_read_data(ctx, data_sz - 1);
|
||||
if (i != (data_sz - 1))
|
||||
return -RYM_ERR_DSZ;
|
||||
|
||||
/* sanity check
|
||||
@@ -509,8 +509,8 @@ static rt_err_t _rym_do_fin(struct rym_ctx *ctx)
|
||||
if (ctx->buf[1] != 0 || ctx->buf[2] != 0xFF)
|
||||
return -RYM_ERR_SEQ;
|
||||
|
||||
recv_crc = (rt_uint16_t)(*(ctx->buf + _RYM_SOH_PKG_SZ - 2) << 8) | *(ctx->buf + _RYM_SOH_PKG_SZ - 1);
|
||||
if (recv_crc != CRC16(ctx->buf + 3, _RYM_SOH_PKG_SZ - 5))
|
||||
recv_crc = (rt_uint16_t)(*(ctx->buf + data_sz - 2) << 8) | *(ctx->buf + data_sz - 1);
|
||||
if (recv_crc != CRC16(ctx->buf + 3, data_sz - 5))
|
||||
return -RYM_ERR_CRC;
|
||||
|
||||
/*next file transmission*/
|
||||
|
||||
Reference in new issue
Block a user