[ymodem] Check the file path's legitimacy of 'sy' command

This commit is contained in:
Meco Man 2021-04-14 01:34:28 +08:00
parent b2f23f2a96
commit a6ac475df3
1 changed files with 7 additions and 0 deletions

View File

@ -6,6 +6,7 @@
* Change Logs: * Change Logs:
* Date Author Notes * Date Author Notes
* 2019-12-09 Steven Liu the first version * 2019-12-09 Steven Liu the first version
* 2021-04-14 Meco Man Check the file path's legitimacy of 'sy' command
*/ */
#include <rtthread.h> #include <rtthread.h>
@ -219,6 +220,12 @@ static rt_err_t sy(uint8_t argc, char **argv)
const char *file_path; const char *file_path;
rt_device_t dev; rt_device_t dev;
if (argc < 2)
{
rt_kprintf("invalid file path.\n");
return -RT_ERROR;
}
if (argc > 2) if (argc > 2)
dev = rt_device_find(argv[2]); dev = rt_device_find(argv[2]);
else else