From: Andre Noll Date: Fri, 21 Apr 2017 18:43:06 +0000 (+0200) Subject: audiod: Avoid uninitialized memory access. X-Git-Tag: v0.6.0~2^2~1 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=b8b85c39eadee1d42857ee7ce31f2a1e04967024 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. --- 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);