diff options
author | Jason Woofenden <jason@jasonwoof.com> | 2012-06-03 14:37:44 +0200 |
---|---|---|
committer | Jason Woofenden <jason@jasonwoof.com> | 2012-06-03 14:37:44 +0200 |
commit | 1fa7f191f0e7a7a026c05aa00cbaddc6befc1904 (patch) | |
tree | 6731f6d23317c902f5820dc4d89f27c5b1ea10e6 /src | |
parent | 7d16a438ca96e276d96cce145ac60057183c5fef (diff) | |
download | dwb-1fa7f191f0e7a7a026c05aa00cbaddc6befc1904.zip |
fix use-after-free in parse_command_line()
---
src/dwb.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
Diffstat (limited to 'src')
-rw-r--r-- | src/dwb.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -3813,10 +3813,14 @@ dwb_parse_command_line(const char *line) { char **token = g_strsplit(bak, " ", 2); KeyMap *m = NULL; gboolean found; + gboolean has_arg = false; if (!token[0]) return STATUS_OK; + if (token[1]) + has_arg = true; + for (GList *l = dwb.keymap; l; l=l->next) { bak = token[0]; found = false; @@ -3858,7 +3862,7 @@ dwb_parse_command_line(const char *line) { return ret; if (m->map->prop & CP_HAS_MODE) return STATUS_OK; - if (!(m->map->prop & CP_DONT_CLEAN) || (m->map->prop & CP_NEEDS_ARG && (token[1] != NULL)) ) { + if (!(m->map->prop & CP_DONT_CLEAN) || (m->map->prop & CP_NEEDS_ARG && has_arg) ) { dwb_change_mode(NORMAL_MODE, dwb.state.message_id == 0); } return ret; |