浏览代码

确保char line[]最后一位为'\0'

z14git 4 年之前
父节点
当前提交
adceb3e2a4
共有 1 个文件被更改,包括 1 次插入2 次删除
  1. 1 2
      components/finsh/shell.h

+ 1 - 2
components/finsh/shell.h

@@ -78,7 +78,7 @@ struct finsh_shell
     struct finsh_parser parser;
 #endif
 
-    char line[FINSH_CMD_SIZE];
+    char line[FINSH_CMD_SIZE + 1];
     rt_uint16_t line_position;
     rt_uint16_t line_curpos;
 
@@ -107,4 +107,3 @@ const char *finsh_get_password(void);
 #endif
 
 #endif
-