mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
Fix crash on OOM in xenParseSxpr
The xenParseSxpr method sets def->nconsoles to 1 before allocating the def->consoles array. If the allocation fails due to OOM the cleanup code will thus crash accessing out of bounds. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
parent
b80fff1444
commit
d508f70df0
@ -1439,9 +1439,9 @@ xenParseSxpr(const struct sexpr *root,
|
|||||||
def->parallels[def->nparallels++] = chr;
|
def->parallels[def->nparallels++] = chr;
|
||||||
}
|
}
|
||||||
} else if (def->id != 0) {
|
} else if (def->id != 0) {
|
||||||
def->nconsoles = 1;
|
|
||||||
if (VIR_ALLOC_N(def->consoles, 1) < 0)
|
if (VIR_ALLOC_N(def->consoles, 1) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
def->nconsoles = 1;
|
||||||
/* Fake a paravirt console, since that's not in the sexpr */
|
/* Fake a paravirt console, since that's not in the sexpr */
|
||||||
if (!(def->consoles[0] = xenParseSxprChar("pty", tty)))
|
if (!(def->consoles[0] = xenParseSxprChar("pty", tty)))
|
||||||
goto error;
|
goto error;
|
||||||
|
Loading…
Reference in New Issue
Block a user