From b8b85c39eadee1d42857ee7ce31f2a1e04967024 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Fri, 21 Apr 2017 20:43:06 +0200 Subject: [PATCH] audiod: Avoid uninitialized memory access. 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/audiod_command.c b/audiod_command.c index 8319b0f1..9623c4f5 100644 --- a/audiod_command.c +++ b/audiod_command.c @@ -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); -- 2.39.5