chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
8bf13eb
)
bus-proxyd: check return values of getpeercred() and getpeersec()
author
Daniel Mack
<daniel@zonque.org>
Tue, 7 Oct 2014 10:36:09 +0000
(12:36 +0200)
committer
Daniel Mack
<daniel@zonque.org>
Tue, 7 Oct 2014 10:36:09 +0000
(12:36 +0200)
If we can't get the remote peer or security creds, bail out.
Spotted by coverity.
src/bus-proxyd/bus-proxyd.c
patch
|
blob
|
history
diff --git
a/src/bus-proxyd/bus-proxyd.c
b/src/bus-proxyd/bus-proxyd.c
index cbec04933c709064cc134b0faf1a7231e2626b60..ce571fa753ddab893c82c9ff526c7bd670301a60 100644
(file)
--- a/
src/bus-proxyd/bus-proxyd.c
+++ b/
src/bus-proxyd/bus-proxyd.c
@@
-1146,8
+1146,17
@@
int main(int argc, char *argv[]) {
sd_is_socket(out_fd, AF_UNIX, 0, 0) > 0;
if (is_unix) {
- getpeercred(in_fd, &ucred);
- getpeersec(in_fd, &peersec);
+ r = getpeercred(in_fd, &ucred);
+ if (r < 0) {
+ log_error("Failed to get peer creds: %s", strerror(-r));
+ goto finish;
+ }
+
+ r = getpeersec(in_fd, &peersec);
+ if (r < 0) {
+ log_error("Failed to get security creds: %s", strerror(-r));
+ goto finish;
+ }
}
if (arg_drop_privileges) {