diff --git a/system/fastboot/fastboot.c b/system/fastboot/fastboot.c index d443bb9c879..83b29528446 100644 --- a/system/fastboot/fastboot.c +++ b/system/fastboot/fastboot.c @@ -870,6 +870,7 @@ static int fastboot_filedump_upload(FAR struct fastboot_ctx_s *ctx) static void fastboot_filedump(FAR struct fastboot_ctx_s *ctx, FAR const char *arg) { + char format[64]; struct stat sb; int ret; @@ -879,7 +880,10 @@ static void fastboot_filedump(FAR struct fastboot_ctx_s *ctx, return; } - ret = sscanf(arg, "%s %" PRIdOFF " %zu", ctx->upload_param.u.file.path, + snprintf(format, sizeof(format), "%%%zus %%" PRIdOFF " %%zu", + sizeof(ctx->upload_param.u.file.path) - 1); + + ret = sscanf(arg, format, ctx->upload_param.u.file.path, &ctx->upload_param.u.file.offset, &ctx->upload_param.size); if (ret != 1 && ret != 3) {