Xymon Mailing List Archive search

[bug?] Crash of hobbitsvc.cgi on trends column display

list Gildas le Nadan
Tue, 28 Nov 2006 15:16:54 +0000
Message-Id: <user-abc99b35f613@xymon.invalid>

[oh, I found another small bug, not severe at all: when running
hobbitsvc.cgi from the command line, it segfaults if SCRIPT_NAME is not
set. Maybe it should set SCRIPT_NAME to a sensible default or at least
exit grcefully]
Yes, the cgis are not all checking that their environment.

I was about to provide patches so they at least call envcheck() as some 
of the cgis are using it.

Something like this will do the trick for hobbigraph.c for instance

--- hobbit-4.2.0-allinone/web/hobbitgraph.c     2006-11-08 
14:08:15.000000000 +0000
+++ hobbit-4.2.0-sanity/web/hobbitgraph.c       2006-11-28 
15:16:10.492252944 +0000
@@ -490,6 +490,13 @@
         char *okuri, *p;
         int urilen;

+       /* first of all, sanity checks */
+       char *reqenv[] = {
+               "BBHOME", "BBRRDS", "SCRIPT_NAME", "RRDHEIGHT",
+               "RRDWIDTH", "HTMLCONTENTTYPE", NULL
+       };
+       envcheck(reqenv);
• graphwidth = atoi(xgetenv("RRDWIDTH"));
         graphheight = atoi(xgetenv("RRDHEIGHT"));

Cheers,
Gildas