<div dir="ltr"><div>Hi,</div><div>I have run into issues with acknowledging alerts on pages where page name is longer than 18 characters.</div><div>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));"</div>
<div>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. </div>
<div><br></div><div>Following change to acknowledge.c seems to fix the issue:</div><div><br></div><div>--- acknowledge.c<span class="" style="white-space:pre"> </span>2014-01-27 16:56:50.000000000 +0000</div><div>+++ acknowledge.c.new<span class="" style="white-space:pre">   </span>2014-08-07 13:01:03.000000000 +0100</div>
<div>@@ -289,7 +289,7 @@</div><div> <span class="" style="white-space:pre">                                        </span>pcre *dummy;</div><div> <span class="" style="white-space:pre">                                     </span>char *re;</div><div> </div><div>-<span class="" style="white-space:pre">                                        </span>re = (char *)malloc(8 + strlen(pagename));</div>
<div>+<span class="" style="white-space:pre">                                   </span>re = (char *)malloc(8 + strlen(pagename)*2);</div><div> <span class="" style="white-space:pre">                                     </span>sprintf(re, "%s$|^%s/.+", pagename, pagename);</div>
<div> <span class="" style="white-space:pre">                                  </span>dummy = compileregex(re);</div><div> <span class="" style="white-space:pre">                                        </span>if (dummy) {</div><div><br></div><div>This was tested on 64 bit Ubuntu 14.04 running xymon 4.3.17.</div>
<div><br></div><div>Regards,</div><div>Martin</div></div>