diff --git a/system/ymodem/rb_main.c b/system/ymodem/rb_main.c index 41878eae1..1beb8c2a2 100644 --- a/system/ymodem/rb_main.c +++ b/system/ymodem/rb_main.c @@ -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) @@ -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; } diff --git a/system/ymodem/ymodem.c b/system/ymodem/ymodem.c index ca7e30ec9..1f8cf6ff6 100644 --- a/system/ymodem/ymodem.c +++ b/system/ymodem/ymodem.c @@ -231,7 +231,7 @@ recv_packet: 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; @@ -239,7 +239,7 @@ 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;