[Xymon] Acknowledge alert doesn't work on pages with page name longer than 18 characters.

Martin Lenko lenko99 at gmail.com
Thu Aug 7 15:25:20 CEST 2014


Hi,
I have run into issues with acknowledging alerts on pages where page name
is longer than 18 characters.
The ack page is just empty - it doesn't show any form. The acknowledge.cgi
script throws "malloc(): memory corruption" error when its error output is
redirected to some file. I have track it down to memory allocation in
acknowledge.c on line 292: "re = (char *)malloc(8 + strlen(pagename));"
I believe that allocating "(8 + strlen(pagename))" of memory for "re" is
not enough if we put the pagename into it twice in the next line
"sprintf(re, "%s$|^%s/.+", pagename, pagename);". I'm not quite sure why it
works for names shorter than 19 chars though.

Following change to acknowledge.c seems to fix the issue:

--- acknowledge.c 2014-01-27 16:56:50.000000000 +0000
+++ acknowledge.c.new 2014-08-07 13:01:03.000000000 +0100
@@ -289,7 +289,7 @@
  pcre *dummy;
  char *re;

- re = (char *)malloc(8 + strlen(pagename));
+ re = (char *)malloc(8 + strlen(pagename)*2);
  sprintf(re, "%s$|^%s/.+", pagename, pagename);
  dummy = compileregex(re);
  if (dummy) {

This was tested on 64 bit Ubuntu 14.04 running xymon 4.3.17.

Regards,
Martin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.xymon.com/pipermail/xymon/attachments/20140807/fa74ddbe/attachment.html>


More information about the Xymon mailing list