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@amazon.com>
Signed-off-by: Norbert Manthey <nmanthey@amazon.de>
Reviewed-by: Thomas Friebel <friebelt@amazon.de>
Reviewed-by: Julien Grall <jgrall@amazon.co.uk>
Reviewed-by: Juergen Gross <jgross@suse.com>
Release-Acked-by: Ian Jackson <iwj@xenproject.org>
This commit is contained in:
Michael Kurth authored and Julien Grall committed 2021-03-03 18:18:45 +00:00
1 parent e0ca7b883a
commit ff3e7e7681
1 file changed
+5
+5
View File
@@ -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;
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.