am 42b871f1: am c37ba1c9: Merge "Check fastboot oem command line length"

Merge commit '42b871f1bfc116d53d1bff9d7497415494b2e0e0'

* commit '42b871f1bfc116d53d1bff9d7497415494b2e0e0':
  Check fastboot oem command line length
This commit is contained in:
Jean-Baptiste Queru 2010-07-29 11:11:07 -07:00 committed by Android Git Automerger
commit 69f2d3ce91
1 changed files with 7 additions and 1 deletions

View File

@ -97,14 +97,20 @@ static Action *queue_action(unsigned op, const char *fmt, ...)
{
Action *a;
va_list ap;
size_t cmdsize;
a = calloc(1, sizeof(Action));
if (a == 0) die("out of memory");
va_start(ap, fmt);
vsprintf(a->cmd, fmt, ap);
cmdsize = vsnprintf(a->cmd, sizeof(a->cmd), fmt, ap);
va_end(ap);
if (cmdsize >= sizeof(a->cmd)) {
free(a);
die("Command length (%d) exceeds maximum size (%d)", cmdsize, sizeof(a->cmd));
}
if (action_last) {
action_last->next = a;
} else {