From 8a02d1a30b33beac701b39549683c0536ad093ef Mon Sep 17 00:00:00 2001 From: Thadeu Lima de Souza Cascardo Date: Sun, 31 Aug 2008 01:51:26 -0300 Subject: [PATCH] Avoid a crash if there is no index configured --- frontend/cgi/cgi.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/frontend/cgi/cgi.c b/frontend/cgi/cgi.c index f77fe06..7b8ac55 100644 --- a/frontend/cgi/cgi.c +++ b/frontend/cgi/cgi.c @@ -33,7 +33,14 @@ cgi_serve_request (AtomCtx *ctx) return; if (path == NULL) { - path = atom_config_get_str (ctx, "cgi", "index"); + if ((path = atom_config_get_str (ctx, "cgi", "index")) == NULL) + { + /* We do not want to disclose our configuration is empty. + * The requester cannot distinguish an empty configuration + * from a non-existent index. + */ + fprintf (stdout, "Status: 404 Not Found\n\n"); + } } if (!strcmp (method, "GET")) { -- 2.20.1