[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen staging] xenstore: add missing NULL check
commit ff3e7e76813a7958e583e6d7e9090ff9b6df1ecd Author: Michael Kurth <mku@xxxxxxxxxx> AuthorDate: Fri Feb 26 15:41:42 2021 +0100 Commit: Julien Grall <jgrall@xxxxxxxxxx> CommitDate: Wed Mar 3 18:18:45 2021 +0000 xenstore: add missing NULL check In case of allocation error, we should not dereference the obtained NULL pointer. This bug was discovered and resolved using Coverity Static Analysis Security Testing (SAST) by Synopsys, Inc. Signed-off-by: Michael Kurth <mku@xxxxxxxxxx> Signed-off-by: Norbert Manthey <nmanthey@xxxxxxxxx> Reviewed-by: Thomas Friebel <friebelt@xxxxxxxxx> Reviewed-by: Julien Grall <jgrall@xxxxxxxxxxxx> Reviewed-by: Juergen Gross <jgross@xxxxxxxx> Release-Acked-by: Ian Jackson <iwj@xxxxxxxxxxxxxx> --- tools/xenstore/xenstored_core.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_core.c index 8febd09f55..8033c1e0eb 100644 --- a/tools/xenstore/xenstored_core.c +++ b/tools/xenstore/xenstored_core.c @@ -504,6 +504,11 @@ int write_node_raw(struct connection *conn, TDB_DATA *key, struct node *node, } data.dptr = talloc_size(node, data.dsize); + if (!data.dptr) { + errno = ENOMEM; + return errno; + } + hdr = (void *)data.dptr; hdr->generation = node->generation; hdr->num_perms = node->perms.num; -- generated by git-patchbot for /home/xen/git/xen.git#staging
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |