• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

system/corennnnn


Commit MetaInfo

Revisão3649e2500445e03aca631f3bb381acbfc0239e8e (tree)
Hora2011-08-04 17:36:35
AutorChih-Wei Huang <cwhuang@linu...>
CommiterChih-Wei Huang

Mensagem de Log

init: make sure the last parameter to execve is NULL

Extend the buffer to hold one more pointer, and set it is NULL.

Change-Id: I3018d62a1b0d61c0a3f5f2f7ffa12c7ce9ee32c5

Mudança Sumário

Diff

--- a/init/init_parser.c
+++ b/init/init_parser.c
@@ -662,7 +662,12 @@ static void parse_line_action(struct parse_state* state, int nargs, char **args)
662662 n > 2 ? "arguments" : "argument");
663663 return;
664664 }
665- cmd = malloc(sizeof(*cmd) + sizeof(char*) * nargs);
665+ cmd = calloc(1, sizeof(*cmd) + sizeof(char*) * (nargs + 1));
666+ if (!cmd) {
667+ parse_error(state, "malloc failed\n");
668+ return;
669+ }
670+
666671 cmd->func = kw_func(kw);
667672 cmd->nargs = nargs;
668673 memcpy(cmd->args, args, sizeof(char*) * nargs);