Skip to content
This repository has been archived by the owner on Nov 9, 2021. It is now read-only.

Commit

Permalink
Merged PR 10374: Merge defect/172467-reapsysl to master
Browse files Browse the repository at this point in the history
Simplify the regular expression to avoid issues with recursion in large messages.
Ensure the syslog messages are copied when expanding the buffers.

Related work items: #172467
  • Loading branch information
RBoulton-BT committed Jan 17, 2019
1 parent ce900db commit 0eb26b4
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions reapsysl/server/reader/reader.c
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ RSysSrvParseLine(

if (!bLogThis)
{
RSYS_LOG_INFO("Ignoring unmatched event of type %s due to configuration setttings", pLine->pSource->pszEventType);
RSYS_LOG_INFO("Ignoring unmatched event of type %s due to configuration settings", pLine->pSource->pszEventType);

*pbNonBlank = FALSE;
goto cleanup;
Expand Down Expand Up @@ -651,7 +651,7 @@ RSysSrvReadSource(

dwError = regcomp(
&repeatRegEx,
"[^ ]+ +[^ ]+ [^ ]+ [^ ]+ last message repeated ([0-9]+) times?( ---)?",
"last message repeated ([0-9]+) times?",
REG_EXTENDED);
BAIL_ON_RSYS_ERROR(dwError);
bCompiledRegEx = TRUE;
Expand Down Expand Up @@ -690,8 +690,10 @@ RSysSrvReadSource(
sNewLen));
BAIL_ON_RSYS_ERROR(dwError);

pSource->pszReadDataStart += pszNewBuffer - pSource->pszReadBufferStart;
pSource->pszReadDataEnd += pszNewBuffer - pSource->pszReadBufferStart;
memcpy(pszNewBuffer, pSource->pszReadBufferStart, pSource->pszReadBufferEnd - pSource->pszReadBufferStart);

pSource->pszReadDataStart = pszNewBuffer + (pSource->pszReadDataStart - pSource->pszReadBufferStart);
pSource->pszReadDataEnd = pszNewBuffer + (pSource->pszReadDataEnd - pSource->pszReadBufferStart);

LW_RTL_FREE(&pSource->pszReadBufferStart);

Expand Down

0 comments on commit 0eb26b4

Please sign in to comment.