summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKarel Zak <kzak@redhat.com>2015-08-06 13:46:49 +0200
committerKarel Zak <kzak@redhat.com>2015-08-06 13:46:49 +0200
commit93b1da852547c7f6adfaf1b3ff529927202a496d (patch)
tree36ca8ec4225a93a945ac4e9ae5545a6f5724a4b4 /src
parent0610939d6bd21873cd2a8d945daff86c477a5015 (diff)
udev: variable dereferenced before check 'cmsg'
Diffstat (limited to 'src')
-rw-r--r--src/udev/udev-ctrl.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/udev/udev-ctrl.c b/src/udev/udev-ctrl.c
index b0ad277f73..b4ae0944eb 100644
--- a/src/udev/udev-ctrl.c
+++ b/src/udev/udev-ctrl.c
@@ -379,13 +379,14 @@ struct udev_ctrl_msg *udev_ctrl_receive_msg(struct udev_ctrl_connection *conn) {
cmsg_close_all(&smsg);
cmsg = CMSG_FIRSTHDR(&smsg);
- cred = (struct ucred *) CMSG_DATA(cmsg);
if (cmsg == NULL || cmsg->cmsg_type != SCM_CREDENTIALS) {
log_error("no sender credentials received, message ignored");
goto err;
}
+ cred = (struct ucred *) CMSG_DATA(cmsg);
+
if (cred->uid != 0) {
log_error("sender uid="UID_FMT", message ignored", cred->uid);
goto err;