From de23e3ef8ce50975077b39de45076262696639d7 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Fri, 7 Sep 2007 15:21:14 +0000 Subject: applied patch by varmojfekoj two fix two potential segfault situations --- msg.c | 2 +- omfile.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/msg.c b/msg.c index 1837e58c..eaa11739 100644 --- a/msg.c +++ b/msg.c @@ -1663,7 +1663,7 @@ char *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe, if(pTpe->data.field.options.bDropLastLF && !pTpe->data.field.options.bEscapeCC) { int iLn = strlen(pRes); char *pB; - if(*(pRes + iLn - 1) == '\n') { + if(iLn > 0 && *(pRes + iLn - 1) == '\n') { /* we have a LF! */ /* check if we need to obtain a private copy */ if(*pbMustBeFreed == 0) { diff --git a/omfile.c b/omfile.c index 3e76439b..2035b3b4 100644 --- a/omfile.c +++ b/omfile.c @@ -417,7 +417,7 @@ static int prepareDynFile(instanceData *pData, uchar *newFileName, unsigned iMsg * I *hope* this will be a performance enhancement. */ if( (pData->iCurrElt != -1) - && !strcmp((char*) newFileName, (char*) pCache[pData->iCurrElt])) { + && !strcmp((char*) newFileName, (char*) pCache[pData->iCurrElt]->pName)) { /* great, we are all set */ pCache[pData->iCurrElt]->lastUsed = time(NULL); /* update timestamp for LRU */ return 0; @@ -482,6 +482,7 @@ static int prepareDynFile(instanceData *pData, uchar *newFileName, unsigned iMsg else logerrorSz("Could not open dynamic file '%s' - discarding message", (char*)newFileName); dynaFileDelCacheEntry(pCache, iFirstFree, 1); + pData->iCurrElt = -1; return -1; } -- cgit v1.2.3