From a6ac475df33d6e7ad09abff22879bb42962b4262 Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Wed, 14 Apr 2021 01:34:28 +0800 Subject: [PATCH] [ymodem] Check the file path's legitimacy of 'sy' command --- components/utilities/ymodem/ry_sy.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/components/utilities/ymodem/ry_sy.c b/components/utilities/ymodem/ry_sy.c index a87f6949db..caad51d6cd 100644 --- a/components/utilities/ymodem/ry_sy.c +++ b/components/utilities/ymodem/ry_sy.c @@ -6,6 +6,7 @@ * Change Logs: * Date Author Notes * 2019-12-09 Steven Liu the first version + * 2021-04-14 Meco Man Check the file path's legitimacy of 'sy' command */ #include @@ -219,6 +220,12 @@ static rt_err_t sy(uint8_t argc, char **argv) const char *file_path; rt_device_t dev; + if (argc < 2) + { + rt_kprintf("invalid file path.\n"); + return -RT_ERROR; + } + if (argc > 2) dev = rt_device_find(argv[2]); else