[Xymon] Segfault in confreport-critical.sh / confreport.cgi in 4.3.24 (now with backtrace)
Axel Beckert
beckert at phys.ethz.ch
Thu Dec 10 17:38:04 CET 2015
Hi JC,
On Thu, Dec 10, 2015 at 08:23:23AM -0800, J.C. Cleaver wrote:
> On Thu, December 10, 2015 5:59 am, Axel Beckert wrote:
> > On Thu, Dec 10, 2015 at 01:45:49PM +0100, Axel Beckert wrote:
> >> I don't have a proper backtrace (yet), but I had look at the source
> >> code and I'm quite confident that the issue is inside the function
> >> print_alert_recipients() starting at lib/loadalerts.c, line 1124.
> >
> > Here's the according backtrace. Doesn't look too helpful to me,
> > though:
[...]
> > #1 0x0000000000403640 in print_host (testcount=18, testnames=0x167dcc0,
> > host=0x166b070) at confreport.c:310
[...]
> Well, that's different from loadalerts.c,
Indeed. My first guess was solely based on where the interrupted HTML
output comes from.
> but there does seem to be a problem there.
Yeah, I figured in the meanwhile that visdata likely was NULL to cause
that crash. I was just not sure which places would all need changes to
fix that.
> Can you see if this patch helps?
Will check. Thanks for the patch!
> Index: web/confreport.c
> ===================================================================
> --- web/confreport.c (revision 7835)
> +++ web/confreport.c (working copy)
> @@ -288,9 +288,10 @@
> }
> else if (is_net_test(itm)) {
> colname = strdup(itm);
> + visdata = strdup("");
> }
>
> -
> + if (!visdata) visdata = strdup("");
Those two additionans look a little bit redundant, but that shouldn't
cause any harm. (I'd say the first addition shouldn't be necessary
if the second one is present.)
> - newitem->visualdata = (char *)realloc(newitem->visualdata, strlen(newitem->visualdata) + strlen(visdata) + 5);
> + newitem->visualdata = newitem->visualdata ?
> + (char *)realloc(newitem->visualdata, strlen(newitem->visualdata) + strlen(visdata) + 5) :
> + (char *)malloc(strlen(visdata) + 5);
That's the place where I thought, it might need changes, too, but I
had no ideas which exactly.
Kind regards, Axel Beckert
--
Axel Beckert <beckert at phys.ethz.ch> support: +41 44 633 26 68
IT Services Group, HPT H 6 voice: +41 44 633 41 89
Departement of Physics, ETH Zurich
CH-8093 Zurich, Switzerland http://nic.phys.ethz.ch/
More information about the Xymon
mailing list