|
0 |
From f1e6b9d168281196010c44af2eae4587c1d2d088 Mon Sep 17 00:00:00 2001
|
|
1 |
From: Harald Sitter <sitter@kde.org>
|
|
2 |
Date: Wed, 21 Oct 2015 07:38:48 +0200
|
|
3 |
Subject: [PATCH] initialize socket size with correct value
|
|
4 |
|
|
5 |
to quote man 2 accept:
|
|
6 |
> The addrlen argument is a value-result argument: the caller must
|
|
7 |
> initialize it to contain the size (in bytes) of the structure pointed
|
|
8 |
> to by addr; on return it will contain the actual size of the peer
|
|
9 |
> address.
|
|
10 |
|
|
11 |
If addrlen is not correct we may get EINVAL on trying to connect to the
|
|
12 |
environment socket which in turn results in a broken environment of the
|
|
13 |
daemon when started through pam as it will inherit the DM environment.
|
|
14 |
This doesn't have to happen, it does however reproducibly with nvidia-352
|
|
15 |
on Kubuntu 15.10. Why or how nvidia plays into this is not entirely clear,
|
|
16 |
best bet is that it simply is a coincidence where nvidia would have
|
|
17 |
something allocated in the memory beforehand and since the addrlen
|
|
18 |
stack variable was not explicitly initialized to anything it would could
|
|
19 |
potentially be negative (EINVAL condition) or wrong such that it meets
|
|
20 |
an internal error check within accept().
|
|
21 |
|
|
22 |
CHANGELOG: Fixed KWallet configuration file warnings on login
|
|
23 |
FIXED-IN: 5.16
|
|
24 |
BUG: 351805
|
|
25 |
REVIEW: 125717
|
|
26 |
---
|
|
27 |
src/runtime/kwalletd/main.cpp | 2 +-
|
|
28 |
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
29 |
|
|
30 |
Index: kwallet-kf5-5.15.0/src/runtime/kwalletd/main.cpp
|
|
31 |
===================================================================
|
|
32 |
--- kwallet-kf5-5.15.0.orig/src/runtime/kwalletd/main.cpp
|
|
33 |
+++ kwallet-kf5-5.15.0/src/runtime/kwalletd/main.cpp
|
|
34 |
@@ -82,8 +82,8 @@ static int waitForEnvironment()
|
|
35 |
printf("kwalletd: waitingForEnvironment on: %d\n", socketfd);
|
|
36 |
|
|
37 |
int s2;
|
|
38 |
- socklen_t t;
|
|
39 |
struct sockaddr_un remote;
|
|
40 |
+ socklen_t t = sizeof(remote);
|
|
41 |
if ((s2 = accept(socketfd, (struct sockaddr *)&remote, &t)) == -1) {
|
|
42 |
fprintf(stdout, "kwalletd: Couldn't accept incoming connection\n");
|
|
43 |
return -1;
|