[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH XENSTORE v1 09/10] xs: handle daemon socket error
When starting the daemon, we might see a NULL pointer instead of the path to the socket. Only relevant in case we start the process in a very deep directory path, with a length close to 4096 so that appending "/socket" would exceed the limit. Hence, such an error is unlikely, but should still be fixed to not result in a NULL pointer dereference. This bug was discovered and resolved using Coverity Static Analysis Security Testing (SAST) by Synopsys, Inc. Signed-off-by: Norbert Manthey <nmanthey@xxxxxxxxx> Reviewed-by: Thomas Friebel <friebelt@xxxxxxxxx> Reviewed-by: Julien Grall <jgrall@xxxxxxxxxxxx> --- tools/libs/store/xs.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/libs/store/xs.c b/tools/libs/store/xs.c --- a/tools/libs/store/xs.c +++ b/tools/libs/store/xs.c @@ -240,6 +240,9 @@ static struct xs_handle *get_handle(const char *connect_to) struct xs_handle *h = NULL; int saved_errno; + if (!connect_to) + return NULL; + h = malloc(sizeof(*h)); if (h == NULL) goto err; -- 2.17.1 Amazon Development Center Germany GmbH Krausenstr. 38 10117 Berlin Geschaeftsfuehrung: Christian Schlaeger, Jonathan Weiss Eingetragen am Amtsgericht Charlottenburg unter HRB 149173 B Sitz: Berlin Ust-ID: DE 289 237 879
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |