From b7224d321f9325f36fb6b9e124dfa8c4e37ae2c0 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Mon, 7 Nov 2005 09:23:31 +0000 Subject: fixed bugs in TCP sender, init() and message parsing. Some could cause rsyslogd to dump core. --- NEWS | 5 +++++ syslogd.c | 9 +++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index 71f99cfb..4823e01b 100644 --- a/NEWS +++ b/NEWS @@ -13,6 +13,11 @@ Version 1.0.3 (RGer), 2005-10-10 unlikely) - fixed an one-too-low memory allocation in the TCP sender. Could result in rsyslogd dumping core. +- fixed a bug in the TCP sender that caused the retry logic to fail + after an error or receiver overrun +- fixed a bug in init() that could lead to dumping core +- fixed a bug that could lead to dumping core when no HOSTNAME or no TAG + was present in the syslog message --------------------------------------------------------------------------- Version 1.0.2 (RGer), 2005-10-05 - fixed an issue with MySQL error reporting. When an error occured, diff --git a/syslogd.c b/syslogd.c index 3b717f22..fbb896d5 100644 --- a/syslogd.c +++ b/syslogd.c @@ -1008,8 +1008,8 @@ int TCPSend(struct filed *f, char *msg) if(f->f_un.f_forw.savedMsg == NULL) return 0; /* nothing we can do... */ memcpy(f->f_un.f_forw.savedMsg, msg, len + 1); - return 0; } + return 0; } else if(f->f_un.f_forw.status != TCP_SEND_READY) /* This here is debatable. For the time being, we * accept the loss of a single message (e.g. during @@ -1867,8 +1867,7 @@ int MsgSetHOSTNAME(struct msg *pMsg, char* pszHOSTNAME) void MsgAssignTAG(struct msg *pMsg, char *pBuf) { assert(pMsg != NULL); - assert(pBuf != NULL); - pMsg->iLenTAG = strlen(pBuf); + pMsg->iLenTAG = (pBuf == NULL) ? 0 : strlen(pBuf); pMsg->pszTAG = pBuf; } @@ -4463,6 +4462,7 @@ void init() Initialized = 0; if ( nlogs > -1 ) { + struct filed *fPrev; dprintf("Initializing log structures.\n"); f = Files; @@ -4498,8 +4498,9 @@ void init() #endif } /* done with this entry, we now need to delete itself */ + fPrev = f; f = f->f_next; - free(f); + free(fPrev); } /* Reflect the deletion of the Files linked list. */ -- cgit