From 814b8fa78b90928291127edc42d7645a21203150 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 27 Sep 2006 16:13:57 +0000 Subject: fixed a bug in the property replace which lead to an extra TAB at string end if field extraction was used. --- NEWS | 8 ++++++++ syslogd.c | 6 ++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index e53349de..e35de7d1 100644 --- a/NEWS +++ b/NEWS @@ -8,6 +8,14 @@ Version 1.12.x (RGer), 2006-xx-xx - done some modifications to better support Fedora - made the field delimiter inside property replace configurable via template +- fixed a bug in property replacer: if fields were used, the delimitor + became part of the field. Up until now, this was barely noticable as + the delimiter as TAB only and thus invisible to a human. With other + delimiters available now, it quickly showed up. This bug fix might cause + some grief to existing installations if they used the extra TAB for + whatever reasons - sorry folks... Anyhow, a solution is easy: just add + a TAB character contstant into your template. Thus, there has no attempt + been made to do this in a backwards-compatible way. --------------------------------------------------------------------------- Version 1.12.2 (RGer), 2006-02-15 - fixed a bug in the RFC 3339 date formatter. An extra space was added diff --git a/syslogd.c b/syslogd.c index b6fe4d0f..5ae2f58b 100644 --- a/syslogd.c +++ b/syslogd.c @@ -3177,8 +3177,8 @@ dprintf("compare %d != %d: %d (field %d)\n", (unsigned char) *pFld, pTpe->data.f pFldEnd = pFld; while(*pFldEnd && *pFldEnd != pTpe->data.field.field_delim) ++pFldEnd; - if(*pFldEnd == '\0') - --pFldEnd; /* back of to last real char */ + --pFldEnd; /* we are already at the delimiter - so we need to + * step back a little not to copy it as part of the field. */ /* we got our end pointer, now do the copy */ /* TODO: code copied from below, this is a candidate for a separate function */ iLen = pFldEnd - pFld + 1; /* the +1 is for an actual char, NOT \0! */ @@ -3197,6 +3197,8 @@ dprintf("field len %d, start '%s'\n", iLen, pFld); free(pRes); pRes = pBufStart; *pbMustBeFreed = 1; + if(*(pFldEnd+1) != '\0') + ++pFldEnd; /* OK, skip again over delimiter char */ } else { /* field not found, return error */ if(*pbMustBeFreed == 1) -- cgit