diff options
author | Ciprian Dorin, Craciun <ciprian@volution.ro> | 2009-11-28 17:21:19 +0200 |
---|---|---|
committer | Dieter Plaetinck <dieter@plaetinck.be> | 2009-12-01 22:06:03 +0100 |
commit | 090845c0a98658a548b470289b896fccc989dae2 (patch) | |
tree | 47b8485bb2f404cceb17061cc12cd5cf07f47cb5 | |
parent | f8a063cb02c647f849f7e31189f3503e8d9d0fc8 (diff) |
Fixed `expand(const char *s, guint recurse)` by checking if s (the string to expand) is not null.
The problem appears from the following:
* if `new_window` variable is set, `run_handler` is called;
> if (uzbl.behave.new_window) {
> GString *s = g_string_new ("");
> g_string_printf(s, "'%s'", uri);
> run_handler(uzbl.behave.new_window, s->str);
> send_event(NEW_WINDOW, s->str, NULL);
> return;
> }
* but if `new_window` is not splittable (its only a command),
> char **parts = g_strsplit(act, " ", 2);
* thus `parts[0]` is NULL and `expand` seg-faults uzbl:
> gchar* expanded = expand(parts[1], 0);
> inparts = inject_handler_args(parts[0], expanded, args);
(The current problem should bi fixed in `run_handler`, but also in `expand` for robustness.)
-rw-r--r-- | uzbl-core.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/uzbl-core.c b/uzbl-core.c index c74df19..6be2c7c 100644 --- a/uzbl-core.c +++ b/uzbl-core.c @@ -201,7 +201,7 @@ expand(const char *s, guint recurse) { GString *buf = g_string_new(""); GString *js_ret = g_string_new(""); - while(*s) { + while(s && *s) { switch(*s) { case '\\': g_string_append_c(buf, *++s); |