From 090845c0a98658a548b470289b896fccc989dae2 Mon Sep 17 00:00:00 2001 From: "Ciprian Dorin, Craciun" Date: Sat, 28 Nov 2009 17:21:19 +0200 Subject: 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.) --- uzbl-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'uzbl-core.c') 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); -- cgit v1.2.3