]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
audiod: Avoid uninitialized memory access.
authorAndre Noll <maan@tuebingen.mpg.de>
Fri, 21 Apr 2017 18:43:06 +0000 (20:43 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Fri, 21 Apr 2017 18:43:06 +0000 (20:43 +0200)
In handle_connect(), the local pointer variable errctx is not
initialized. If an error occurs early in the function, for example
because recv_cred_buffer() fails, we jump to the "out" label and try
to print the string errctx points to. This will cause a segfault or
worse, so make sure the variable is always initialized.

This bug was found by the static analyzer of clang.

audiod_command.c

index 8319b0f13cb8cd103cb183e17c29cdb140a27976..9623c4f51453c81deb6f11d97a218bcb8696c987 100644 (file)
@@ -426,7 +426,7 @@ int handle_connect(int accept_fd, fd_set *rfds)
        uid_t uid;
        const struct lls_command *cmd;
        struct lls_parse_result *lpr;
-       char *errctx;
+       char *errctx = NULL;
        const struct audiod_command_info *aci;
 
        ret = para_accept(accept_fd, rfds, &unix_addr, sizeof(struct sockaddr_un), &clifd);