Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 50b3995d authored by Bruce Beare's avatar Bruce Beare
Browse files

Check fastboot oem command line length



Change-Id: I301af09c4ec460c9049b75cc7f4d2c50cfe00ceb
Signed-off-by: default avatarBruce Beare <brucex.j.beare@intel.com>
parent bedaac52
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -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 {