From 4c579b1f0f356e241627265c107757f2568c8daa Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Sat, 5 Sep 2015 12:02:10 -0400 Subject: [PATCH] Fix: Possible passing of NULL pointer to memcpy() MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit _cmd_enable_event() will not jump to the error label in case of memory allocation of the filter bytecode copy. This causes the NULL return of zmalloc to be used by memcpy() directly. Signed-off-by: Jérémie Galarneau --- src/bin/lttng-sessiond/cmd.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/bin/lttng-sessiond/cmd.c b/src/bin/lttng-sessiond/cmd.c index 2ca22c2e9..4cc590a95 100644 --- a/src/bin/lttng-sessiond/cmd.c +++ b/src/bin/lttng-sessiond/cmd.c @@ -1812,6 +1812,7 @@ static int _cmd_enable_event(struct ltt_session *session, filter_copy = zmalloc(filter_size); if (!filter_copy) { ret = LTTNG_ERR_NOMEM; + goto error; } memcpy(filter_copy, filter, filter_size); -- 2.34.1