diff options
Diffstat (limited to 'parse.c')
-rw-r--r-- | parse.c | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -37,6 +37,7 @@ #include "rsyslog.h" #include "net.h" /* struct NetAddr */ #include "parse.h" +#include "debug.h" /* ################################################################# * * private members * @@ -230,7 +231,8 @@ rsRetVal parsSkipWhitespace(rsParsObj *pThis) /* Parse string up to a delimiter. * * Input: - * cDelim - the delimiter + * cDelim - the delimiter. Note that SP within a value always is a delimiter, + * so cDelim is actually an *additional* delimiter. * The following two are for whitespace stripping, * 0 means "no", 1 "yes" * - bTrimLeading @@ -255,13 +257,13 @@ rsRetVal parsDelimCStr(rsParsObj *pThis, cstr_t **ppCStr, char cDelim, int bTrim pC = rsCStrGetBufBeg(pThis->pCStr) + pThis->iCurrPos; - while(pThis->iCurrPos < rsCStrLen(pThis->pCStr) && *pC != cDelim) { + while(pThis->iCurrPos < rsCStrLen(pThis->pCStr) && *pC != cDelim && *pC != ' ') { CHKiRet(cstrAppendChar(pCStr, bConvLower ? tolower(*pC) : *pC)); ++pThis->iCurrPos; ++pC; } - if(*pC == cDelim) { + if(pThis->iCurrPos < cstrLen(pThis->pCStr)) { //BUGFIX!! ++pThis->iCurrPos; /* eat delimiter */ } @@ -429,7 +431,7 @@ rsRetVal parsAddrWithBits(rsParsObj *pThis, struct NetAddr **pIP, int *pBits) switch(getaddrinfo ((char*)pszIP+1, NULL, &hints, &res)) { case 0: - (*pIP)->addr.NetAddr = malloc (res->ai_addrlen); + (*pIP)->addr.NetAddr = MALLOC (res->ai_addrlen); memcpy ((*pIP)->addr.NetAddr, res->ai_addr, res->ai_addrlen); freeaddrinfo (res); break; @@ -468,7 +470,7 @@ rsRetVal parsAddrWithBits(rsParsObj *pThis, struct NetAddr **pIP, int *pBits) switch(getaddrinfo ((char*)pszIP, NULL, &hints, &res)) { case 0: - (*pIP)->addr.NetAddr = malloc (res->ai_addrlen); + (*pIP)->addr.NetAddr = MALLOC (res->ai_addrlen); memcpy ((*pIP)->addr.NetAddr, res->ai_addr, res->ai_addrlen); freeaddrinfo (res); break; |