Mirror of the lttng-dev mailing list
 help / color / mirror / Atom feed
* [lttng-dev] [PATCH lttng-tools] Fix: Possible dereference of null pointers
@ 2015-09-21 20:31 Michael Jeanson
  2015-09-21 21:16 ` Jérémie Galarneau
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Jeanson @ 2015-09-21 20:31 UTC (permalink / raw)


Signed-off-by: Michael Jeanson <mjeanson at efficios.com>
---
 src/common/sessiond-comm/unix.c                      | 6 ++++++
 src/lib/lttng-ctl/filter/filter-visitor-set-parent.c | 4 ++++
 2 files changed, 10 insertions(+)

diff --git a/src/common/sessiond-comm/unix.c b/src/common/sessiond-comm/unix.c
index 4b64161..77a6013 100644
--- a/src/common/sessiond-comm/unix.c
+++ b/src/common/sessiond-comm/unix.c
@@ -281,6 +281,9 @@ ssize_t lttcomm_send_fds_unix_sock(int sock, int *fds, size_t nb_fd)
 	msg.msg_controllen = CMSG_LEN(sizeof_fds);
 
 	cmptr = CMSG_FIRSTHDR(&msg);
+	if (!cmptr) {
+		return -1;
+	}
 	cmptr->cmsg_level = SOL_SOCKET;
 	cmptr->cmsg_type = SCM_RIGHTS;
 	cmptr->cmsg_len = CMSG_LEN(sizeof_fds);
@@ -408,6 +411,9 @@ ssize_t lttcomm_send_creds_unix_sock(int sock, void *buf, size_t len)
 	msg.msg_controllen = CMSG_LEN(sizeof_cred);
 
 	cmptr = CMSG_FIRSTHDR(&msg);
+	if (!cmptr) {
+		return -1;
+	}
 	cmptr->cmsg_level = SOL_SOCKET;
 	cmptr->cmsg_type = LTTNG_SOCK_CREDS;
 	cmptr->cmsg_len = CMSG_LEN(sizeof_cred);
diff --git a/src/lib/lttng-ctl/filter/filter-visitor-set-parent.c b/src/lib/lttng-ctl/filter/filter-visitor-set-parent.c
index 91c89dc..f591fd0 100644
--- a/src/lib/lttng-ctl/filter/filter-visitor-set-parent.c
+++ b/src/lib/lttng-ctl/filter/filter-visitor-set-parent.c
@@ -36,6 +36,10 @@ int update_child(struct filter_node *parent,
 		struct filter_node *old_child,
 		struct filter_node *new_child)
 {
+	if (!parent) {
+		fprintf(stderr, "[error] %s: NULL parent\n", __func__);
+		return -EINVAL;
+	}
 	switch (parent->type) {
 	case NODE_UNKNOWN:
 	default:
-- 
1.9.1




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-09-21 21:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-21 20:31 [lttng-dev] [PATCH lttng-tools] Fix: Possible dereference of null pointers Michael Jeanson
2015-09-21 21:16 ` Jérémie Galarneau

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox