diff --git a/shell/full/src/cmds/dmesg.c b/shell/full/src/cmds/dmesg.c index a03abe81acb7306eadd20872c8597a124fb29098..90ff1fd5670b2e700c553fc64bb2b721cb44c01a 100644 --- a/shell/full/src/cmds/dmesg.c +++ b/shell/full/src/cmds/dmesg.c @@ -655,6 +655,12 @@ INT32 OsDmesgWrite2File(const CHAR *fullpath, const CHAR *buf, UINT32 logSize) { INT32 ret; + const CHAR *prefix = "/temp/"; + INT32 prefixLen = strlen(prefix); + if (strncmp(fullpath, prefix, prefixLen) != 0) { + return -1; + } + INT32 fd = open(fullpath, O_CREAT | O_RDWR | O_APPEND, 0644); /* 0644:file right */ if (fd < 0) { return -1;