summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSander Vrijders <sander@ouroboros.rocks>2019-10-05 13:43:38 +0200
committerDimitri Staessens <dimitri@ouroboros.rocks>2019-10-06 09:12:14 +0200
commitc0ea8b9c98e81f513ae3eaa2f2bf7f47fe528582 (patch)
treeb51683141704237a24e08e230db3152a40823fd2
parentb06ede91561fbac4a7e29e1569d4855c8f3e2d54 (diff)
downloadouroboros-c0ea8b9c98e81f513ae3eaa2f2bf7f47fe528582.tar.gz
ouroboros-c0ea8b9c98e81f513ae3eaa2f2bf7f47fe528582.zip
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 <sander@ouroboros.rocks> Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks>
-rw-r--r--src/irmd/main.c5
1 files changed, 5 insertions, 0 deletions
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);