From c2868684fb80820a49eece0694a504279e368377 Mon Sep 17 00:00:00 2001 From: Sebastian Hammer Date: Sat, 6 Jan 2007 05:32:23 +0000 Subject: [PATCH] Null pointer dereference in several cmd_ functions arose when session had expired (introduced when status element was added). Bug # 790 --- src/http_command.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/http_command.c b/src/http_command.c index 9a14705..086db07 100644 --- a/src/http_command.c +++ b/src/http_command.c @@ -1,5 +1,5 @@ /* - * $Id: http_command.c,v 1.7 2007-01-06 04:54:58 quinn Exp $ + * $Id: http_command.c,v 1.8 2007-01-06 05:32:23 quinn Exp $ */ #include @@ -180,11 +180,13 @@ static void cmd_termlist(struct http_channel *c) int len; int i; char *name = http_argbyname(rq, "name"); - int status = session_active_clients(s->psession); + int status; if (!s) return; + status = session_active_clients(s->psession); + if (!name) name = "subject"; if (strlen(name) > 255) @@ -335,11 +337,13 @@ static void cmd_show(struct http_channel *c) struct http_response *rs = c->response; struct http_session *s = locate_session(rq, rs); char *block = http_argbyname(rq, "block"); - int status = session_active_clients(s->psession); + int status; if (!s) return; + status = session_active_clients(s->psession); + if (block) { if (status && (!s->psession->reclist || !s->psession->reclist->num_records)) @@ -396,11 +400,12 @@ static void cmd_stat(struct http_channel *c) struct http_response *rs = c->response; struct http_session *s = locate_session(rq, rs); struct statistics stat; - int clients = session_active_clients(s->psession); + int clients; if (!s) return; + clients = session_active_clients(s->psession); statistics(s->psession, &stat); wrbuf_rewind(c->wrbuf); -- 1.7.10.4