Author Topic: Bug in logwatch subagent  (Read 7157 times)

Peter Sentveld

  • Newbie
  • *
  • Posts: 5
    • View Profile
Bug in logwatch subagent
« on: February 27, 2013, 09:04:00 pm »
If there's a eventlog entry bigger than the default BUFFER_SIZE then the logwatch enters an endless loop.
If the buffer isn't big enough then there's a realloc with size "bytesNeeded" but the buffersize stays "BUFFER_SIZE" in stead of bufferSize.

diff:
--- C:/Temp/eventlog.cpp-revBASE.svn001.tmp.cpp   Tue Aug 14 19:44:38 2012
+++ D:/Source/netxms/trunk/src/agent/subagents/logwatch/eventlog.cpp   Wed Feb 27 19:56:50 2013
@@ -341,7 +341,7 @@
             {
 retry_read:
                success = ReadEventLog(hLog, EVENTLOG_SEQUENTIAL_READ | EVENTLOG_FORWARDS_READ, 0,
-                                       buffer, BUFFER_SIZE, &bytes, &bytesNeeded);
+                                       buffer, bufferSize, &bytes, &bytesNeeded);
                error = GetLastError();
                if (!success && (error == ERROR_INSUFFICIENT_BUFFER))
                {

Victor Kirhenshtein

  • Lead Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 7200
    • View Profile
Re: Bug in logwatch subagent
« Reply #1 on: February 28, 2013, 09:15:44 am »
Hi!

Thanks for the fix, just committed it into trunk.

Best regards,
Victor