summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2008-03-12 08:20:23 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2008-03-12 08:20:23 +0000
commit7bd24b3576dc085db1c15d40428a238809a912c1 (patch)
treef027a6206554bd5709a5d5b57e17dd4858ae927e
parentb1555cd681652e57f76449e39cb1aae8db7d601b (diff)
downloadrsyslog-7bd24b3576dc085db1c15d40428a238809a912c1.tar.gz
rsyslog-7bd24b3576dc085db1c15d40428a238809a912c1.tar.xz
rsyslog-7bd24b3576dc085db1c15d40428a238809a912c1.zip
bugfix: rsyslogd segfaulted when imfile read an empty line - thanks to
Johnny Tan for an excellent bug report
-rw-r--r--ChangeLog6
-rw-r--r--plugins/imfile/imfile.c33
2 files changed, 25 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index c6c8b072..83e9267f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,12 @@ Version 3.12.2 (rgerhards), 2008-03-??
- converted net.c into a loadable library plugin
- bugfix: debug module now survives unload of loadable module when
printing out function call data
+- bugfix: not properly initialized data could cause several segfaults if
+ there were errors in the config file - thanks to varmojfekoj for the patch
+- bugfix: rsyslogd segfaulted when imfile read an empty line - thanks
+ to Johnny Tan for an excellent bug report
+- implemented dynamic module unload capability (not visible to end user)
+- some more internal cleanup
---------------------------------------------------------------------------
Version 3.12.1 (rgerhards), 2008-03-06
- added library plugins, which can be automatically loaded
diff --git a/plugins/imfile/imfile.c b/plugins/imfile/imfile.c
index c65fc436..b431fbbc 100644
--- a/plugins/imfile/imfile.c
+++ b/plugins/imfile/imfile.c
@@ -81,20 +81,25 @@ static fileInfo_t files[MAX_INPUT_FILES];
*/
static rsRetVal enqLine(fileInfo_t *pInfo, cstr_t *cstrLine)
{
- DEFiRet;
- msg_t *pMsg;
-
- CHKiRet(msgConstruct(&pMsg));
- MsgSetUxTradMsg(pMsg, (char*)rsCStrGetSzStr(cstrLine));
- MsgSetRawMsg(pMsg, (char*)rsCStrGetSzStr(cstrLine));
- MsgSetMSG(pMsg, (char*)rsCStrGetSzStr(cstrLine));
- MsgSetHOSTNAME(pMsg, LocalHostName);
- MsgSetTAG(pMsg, (char*)pInfo->pszTag);
- pMsg->iFacility = LOG_FAC(pInfo->iFacility);
- pMsg->iSeverity = LOG_PRI(pInfo->iSeverity);
- pMsg->bParseHOSTNAME = 0;
- datetime.getCurrTime(&(pMsg->tTIMESTAMP)); /* use the current time! */
- CHKiRet(submitMsg(pMsg));
+ DEFiRet;
+ msg_t *pMsg;
+
+ if(rsCStrLen(cstrLine) == 0) {
+ /* we do not process empty lines */
+ FINALIZE;
+ }
+
+ CHKiRet(msgConstruct(&pMsg));
+ MsgSetUxTradMsg(pMsg, (char*)rsCStrGetSzStr(cstrLine));
+ MsgSetRawMsg(pMsg, (char*)rsCStrGetSzStr(cstrLine));
+ MsgSetMSG(pMsg, (char*)rsCStrGetSzStr(cstrLine));
+ MsgSetHOSTNAME(pMsg, LocalHostName);
+ MsgSetTAG(pMsg, (char*)pInfo->pszTag);
+ pMsg->iFacility = LOG_FAC(pInfo->iFacility);
+ pMsg->iSeverity = LOG_PRI(pInfo->iSeverity);
+ pMsg->bParseHOSTNAME = 0;
+ datetime.getCurrTime(&(pMsg->tTIMESTAMP)); /* use the current time! */
+ CHKiRet(submitMsg(pMsg));
finalize_it:
RETiRet;
}