From c0ea8b9c98e81f513ae3eaa2f2bf7f47fe528582 Mon Sep 17 00:00:00 2001 From: Sander Vrijders Date: Sat, 5 Oct 2019 13:43:38 +0200 Subject: irmd: Check if entry actually exists The prog table was consulted for a name of a program, which may not exist, thus prog_entry_del_name potentially got a NULL reference passed. Signed-off-by: Sander Vrijders Signed-off-by: Dimitri Staessens --- src/irmd/main.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/irmd') diff --git a/src/irmd/main.c b/src/irmd/main.c index f3a3ff87..19875d1c 100644 --- a/src/irmd/main.c +++ b/src/irmd/main.c @@ -844,6 +844,11 @@ static int unbind_program(char * prog, prog_table_del(&irmd.prog_table, prog); else { struct prog_entry * en = prog_table_get(&irmd.prog_table, prog); + if (en == NULL) { + pthread_rwlock_unlock(&irmd.reg_lock); + return -EINVAL; + } + prog_entry_del_name(en, name); e = registry_get_entry(&irmd.registry, name); -- cgit v1.2.3