diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | plugins/omtesting/omtesting.c | 2 | ||||
-rw-r--r-- | runtime/conf.c | 7 | ||||
-rw-r--r-- | runtime/ctok.c | 2 | ||||
-rw-r--r-- | template.c | 10 |
5 files changed, 19 insertions, 8 deletions
@@ -1,4 +1,10 @@ --------------------------------------------------------------------------- +Version 5.6.3 [V5-STABLE] (rgerhards), 2010-12-?? +- bugfix: unitialized variable could cause issues under extreme conditions + plus some minor nits. This was found after a clang static code analyzer + analysis (great tool, and special thanks to Marcin for telling me about + it!) +--------------------------------------------------------------------------- Version 5.6.2 [V5-STABLE] (rgerhards), 2010-11-30 - bugfix: compile failed on systems without epoll_create1() Thanks to David Hill for providing a fix. diff --git a/plugins/omtesting/omtesting.c b/plugins/omtesting/omtesting.c index 9442f691..c474bb41 100644 --- a/plugins/omtesting/omtesting.c +++ b/plugins/omtesting/omtesting.c @@ -188,8 +188,10 @@ CODESTARTdoAction break; case MD_RANDFAIL: iRet = doRandFail(); + break; case MD_ALWAYS_SUSPEND: iRet = RS_RET_SUSPENDED; + break; } if(iRet == RS_RET_OK && pData->bEchoStdout) { diff --git a/runtime/conf.c b/runtime/conf.c index d41f2950..529142ed 100644 --- a/runtime/conf.c +++ b/runtime/conf.c @@ -1084,7 +1084,7 @@ static rsRetVal cflineDoAction(uchar **p, action_t **ppAction) DEFiRet; modInfo_t *pMod; omodStringRequest_t *pOMSR; - action_t *pAction; + action_t *pAction = NULL; void *pModData; ASSERT(p != NULL); @@ -1092,6 +1092,11 @@ static rsRetVal cflineDoAction(uchar **p, action_t **ppAction) /* loop through all modules and see if one picks up the line */ pMod = module.GetNxtType(NULL, eMOD_OUT); + /* Note: clang static analyzer reports that pMod mybe == NULL. However, this is + * not possible, because we have the built-in output modules which are always + * present. Anyhow, we guard this by an assert. -- rgerhards, 2010-12-16 + */ + assert(pMod != NULL); while(pMod != NULL) { pOMSR = NULL; iRet = pMod->mod.om.parseSelectorAct(p, &pModData, &pOMSR); diff --git a/runtime/ctok.c b/runtime/ctok.c index 18ddaed2..a17d0ec9 100644 --- a/runtime/ctok.c +++ b/runtime/ctok.c @@ -267,7 +267,7 @@ ctokGetVar(ctok_t *pThis, ctok_token_t *pToken) { DEFiRet; uchar c; - cstr_t *pstrVal; + cstr_t *pstrVal = NULL; ISOBJ_TYPE_assert(pThis, ctok); ASSERT(pToken != NULL); @@ -86,9 +86,9 @@ rsRetVal tplToString(struct template *pTpl, msg_t *pMsg, uchar **ppBuf, size_t * DEFiRet; struct templateEntry *pTpe; size_t iBuf; - unsigned short bMustBeFreed; + unsigned short bMustBeFreed = 0; uchar *pVal; - size_t iLenVal; + size_t iLenVal = 0; assert(pTpl != NULL); assert(pMsg != NULL); @@ -1046,7 +1046,6 @@ void tplDeleteAll(void) { struct template *pTpl, *pTplDel; struct templateEntry *pTpe, *pTpeDel; - rsRetVal iRetLocal; BEGINfunc pTpl = tplRoot; @@ -1069,7 +1068,7 @@ void tplDeleteAll(void) case FIELD: /* check if we have a regexp and, if so, delete it */ if(pTpeDel->data.field.has_regex != 0) { - if((iRetLocal = objUse(regexp, LM_REGEXP_FILENAME)) == RS_RET_OK) { + if(objUse(regexp, LM_REGEXP_FILENAME) == RS_RET_OK) { regexp.regfree(&(pTpeDel->data.field.re)); } } @@ -1095,7 +1094,6 @@ void tplDeleteNew(void) { struct template *pTpl, *pTplDel; struct templateEntry *pTpe, *pTpeDel; - rsRetVal iRetLocal; BEGINfunc @@ -1124,7 +1122,7 @@ void tplDeleteNew(void) case FIELD: /* check if we have a regexp and, if so, delete it */ if(pTpeDel->data.field.has_regex != 0) { - if((iRetLocal = objUse(regexp, LM_REGEXP_FILENAME)) == RS_RET_OK) { + if(objUse(regexp, LM_REGEXP_FILENAME) == RS_RET_OK) { regexp.regfree(&(pTpeDel->data.field.re)); } } |