Explorar el Código

fix shell msh_exec memory over-bound.

geniusgogo hace 4 años
padre
commit
6c01083502
Se han modificado 1 ficheros con 1 adiciones y 1 borrados
  1. 1 1
      components/finsh/msh.c

+ 1 - 1
components/finsh/msh.c

@@ -374,7 +374,7 @@ int msh_exec(char *cmd, rt_size_t length)
     int cmd_ret;
 
     /* strim the beginning of command */
-    while (*cmd  == ' ' || *cmd == '\t')
+    while ((length > 0) && (*cmd  == ' ' || *cmd == '\t'))
     {
         cmd++;
         length--;