Avoid a crash if there is no index configured
authorThadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
Sun, 31 Aug 2008 04:51:26 +0000 (01:51 -0300)
committerThadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
Sun, 31 Aug 2008 04:51:26 +0000 (01:51 -0300)
frontend/cgi/cgi.c

index f77fe06..7b8ac55 100644 (file)
@@ -33,7 +33,14 @@ cgi_serve_request (AtomCtx *ctx)
     return;
   if (path == NULL)
     {
     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"))
     {
     }
   if (!strcmp (method, "GET"))
     {