[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen master] xenstore: handle daemon creation errors



commit 60f0ba136d5a4c88377e28e5eb40606a7f9f6785
Author:     Norbert Manthey <nmanthey@xxxxxxxxx>
AuthorDate: Fri Feb 26 15:41:39 2021 +0100
Commit:     Julien Grall <jgrall@xxxxxxxxxx>
CommitDate: Thu Apr 1 17:12:05 2021 +0100

    xenstore: handle daemon creation errors
    
    In rare cases, the path to the daemon socket cannot be created as it is
    longer than PATH_MAX. Instead of failing with a NULL pointer dereference,
    terminate the application with an error message.
    
    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>
    Reviewed-by: Juergen Gross <jgross@xxxxxxxx>
---
 tools/xenstore/xenstored_core.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_core.c
index 8033c1e0eb..d54a6042a9 100644
--- a/tools/xenstore/xenstored_core.c
+++ b/tools/xenstore/xenstored_core.c
@@ -2005,6 +2005,9 @@ static void init_sockets(void)
        struct sockaddr_un addr;
        const char *soc_str = xs_daemon_socket();
 
+       if (!soc_str)
+               barf_perror("Failed to obtain xs domain socket");
+
        /* Create sockets for them to listen to. */
        atexit(destroy_fds);
        sock = socket(PF_UNIX, SOCK_STREAM, 0);
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.