From fcf96f5a8e25fe2642b4269727313a5f25fbe7cb Mon Sep 17 00:00:00 2001 From: Jayadeep Karnati Date: Tue, 28 Nov 2017 16:37:29 +0530 Subject: [PATCH] Return error for aul_window_focused_pid(NULL) If NULL is passed as pid address, the caller app crashes. This check returns error instead of crashing. Change-Id: I8e48a0951e572e1ba8c3bba7ce5b0290c65aec28 Signed-off-by: Jayadeep Karnati (cherry picked from commit 330df9a9492ae96b269cd06213dc4451bc20c4c2) --- src/aul_window.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/aul_window.c b/src/aul_window.c index 5181130..db71a82 100644 --- a/src/aul_window.c +++ b/src/aul_window.c @@ -284,6 +284,11 @@ API int aul_window_get_focused_pid(pid_t *pid) GVariant *body; gint32 focused_pid = 0; + if (!pid) { + _E("aul_window_get_focused_pid: argument 'pid' cannot be NULL."); + return -1; + } + _W("call aul_window_get_focused_pid()"); if (system_conn == NULL) { conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &err); -- 2.7.4