[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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



[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