From 6ce49cd43d303d5caab2e82ac0c4cef32026cb69 Mon Sep 17 00:00:00 2001 From: Scoopta Date: Fri, 10 Apr 2020 21:55:03 -0700 Subject: [PATCH] Fixed use after free --- src/wofi.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/wofi.c b/src/wofi.c index b5a0de7..e99554f 100644 --- a/src/wofi.c +++ b/src/wofi.c @@ -1360,7 +1360,11 @@ static void parse_mods(char* key, void (*action)(void)) { mod = NULL; } struct key_entry* entry = malloc(sizeof(struct key_entry)); - entry->mod = mod; + if(mod == NULL) { + entry->mod = NULL; + } else { + entry->mod = strdup(mod); + } entry->action = action; map_put_void(keys, str, entry); } while((str = strtok_r(NULL, ",", &save_ptr)) != NULL);