summaryrefslogtreecommitdiff
path: root/components/utilities/ymodem
diff options
context:
space:
mode:
authorsulfurandcu <[email protected]>2024-10-08 08:32:49 +0800
committerMeco Man <[email protected]>2024-10-07 23:13:41 -0400
commit85bd74640ecacc7b6e652fdda1bc38ae70756068 (patch)
tree81cb2dc39f530cf73587df735b95ef07eff4d72f /components/utilities/ymodem
parent43a727691d1b22a45222649956a2ee66d19cabc2 (diff)
[Bug] [ymodem] last frame's data_sz issue, fixed.
Diffstat (limited to 'components/utilities/ymodem')
-rw-r--r--components/utilities/ymodem/ymodem.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/components/utilities/ymodem/ymodem.c b/components/utilities/ymodem/ymodem.c
index f554d81f98..fefa9fe69f 100644
--- a/components/utilities/ymodem/ymodem.c
+++ b/components/utilities/ymodem/ymodem.c
@@ -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*/