Skip to content

Commit

Permalink
ymodem:fix compile warnings
Browse files Browse the repository at this point in the history
rb_main.c:219:42: warning: 'snprintf' output may be truncated before the last format character [-Wformat-truncation=]
  219 |           snprintf(temp, PATH_MAX, "%s/%s", priv->foldname,

Signed-off-by: anjiahao <[email protected]>
  • Loading branch information
anjiahao1 committed Jul 30, 2023
1 parent fe24df6 commit de89194
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions system/ymodem/rb_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ static int handler(FAR struct ymodem_ctx_s *ctx)

if (ctx->packet_type == YMODEM_FILENAME_PACKET)
{
char temp[PATH_MAX];
char temp[PATH_MAX + 1];
FAR char *filename;

if (priv->fd > 0)
Expand Down Expand Up @@ -216,7 +216,7 @@ static int handler(FAR struct ymodem_ctx_s *ctx)

if (priv->foldname != NULL)
{
snprintf(temp, PATH_MAX, "%s/%s", priv->foldname,
snprintf(temp, sizeof(temp), "%s/%s", priv->foldname,
filename);
filename = temp;
}
Expand Down
4 changes: 2 additions & 2 deletions system/ymodem/ymodem.c
Original file line number Diff line number Diff line change
Expand Up @@ -231,15 +231,15 @@ static int ymodem_recv_file(FAR struct ymodem_ctx_s *ctx)
if ((total_seq & 0xff) - 1 == ctx->header[1])
{
ymodem_debug("recv_file: Received the previous packet that has"
"been received, continue %lu %u\n", total_seq,
"been received, continue %" PRIu32 " %u\n", total_seq,
ctx->header[1]);

ctx->header[0] = ACK;
goto recv_packet;
}
else if ((total_seq & 0xff) != ctx->header[1])
{
ymodem_debug("recv_file: total seq error:%lu %u\n", total_seq,
ymodem_debug("recv_file: total seq error:%" PRIu32 " %u\n", total_seq,
ctx->header[1]);
ctx->header[0] = CRC;
goto recv_packet;
Expand Down

0 comments on commit de89194

Please sign in to comment.