7613 Commits

Author SHA1 Message Date
Rainer Gerhards
c2c8c26c87 Merge branch 'v7-stable' into v8-stable
Conflicts:
	plugins/imfile/imfile.c
2014-07-13 13:07:08 +02:00
Rainer Gerhards
14fef23001 Merge branch 'v7-stable' of git+ssh://git.adiscon.com/git/rsyslog into v7-stable 2014-07-13 13:01:02 +02:00
Rainer Gerhards
bb0a0352e6 Merge remote-tracking branch 'github/v7-stable-th-coverity' into v7-stable 2014-07-13 13:00:51 +02:00
Rainer Gerhards
6d668c915f cosmetic: fix some gcc --pedantic messages 2014-07-13 12:43:07 +02:00
Rainer Gerhards
a45ea8a144 testbench: make more reliable shutdown
so far, we checked only the main queue size to become zero, ignoring
the sizes of action queues. For some tests, this caused racieness and
unreliability. Now, we check all queues. This should make matters
much more stable.
2014-07-11 17:23:21 +02:00
Rainer Gerhards
244ca62e33 Merge branch 'v8-stable' 2014-07-11 15:32:54 +02:00
Rainer Gerhards
bb48b34db0 Merge branch 'v7-stable' into v8-stable 2014-07-11 15:32:45 +02:00
Rainer Gerhards
c3db2ef98d add --enable-generate-man-pages configure switch (default: enabled)
This forces generation of man pages, even if cached ones exists. This
"fixes" a typical release tarball nit. While it is hackish, the
benefit is clear given the history of failed tarball releases since
we changed the cached man page handling. It was just too easy to get
that wrong.
2014-07-11 15:32:10 +02:00
Tomas Heinrich
c3caf0f4f6 bugfix: plug a memleak in imudp
Error: RESOURCE_LEAK (CWE-772):
rsyslog-7.4.10/plugins/imudp/imudp.c:413: alloc_arg: "msgConstructWithTime(msg_t **, struct syslogTime *, time_t)" allocates memory that is stored into "pMsg".
rsyslog-7.4.10/runtime/msg.c:745:2: alloc_arg: "msgBaseConstruct(msg_t **)" allocates memory that is stored into "*ppThis".
rsyslog-7.4.10/runtime/msg.c:674:2: alloc_fn: Storage is returned from allocation function "malloc(size_t)".
rsyslog-7.4.10/runtime/msg.c:674:2: var_assign: Assigning: "pM" = "malloc(576UL)".
rsyslog-7.4.10/runtime/msg.c:725:2: var_assign: Assigning: "*ppThis" = "pM".
rsyslog-7.4.10/plugins/imudp/imudp.c:414: noescape: Resource "pMsg" is not freed or pointed-to in function "MsgSetRawMsg(msg_t *, char *, size_t)".
rsyslog-7.4.10/runtime/msg.c:2403:26: noescape: "MsgSetRawMsg(msg_t *, char *, size_t)" does not free or save its pointer parameter "pThis".
rsyslog-7.4.10/plugins/imudp/imudp.c:415: noescape: Resource "pMsg" is not freed or pointed-to in function "MsgSetInputName(msg_t *, prop_t *)".
rsyslog-7.4.10/runtime/msg.c:2208:29: noescape: "MsgSetInputName(msg_t *, prop_t *)" does not free or save its pointer parameter "pThis".
rsyslog-7.4.10/plugins/imudp/imudp.c:416: noescape: Resource "pMsg" is not freed or pointed-to in function "MsgSetRuleset(msg_t *, ruleset_t *)".
rsyslog-7.4.10/runtime/msg.c:1921:27: noescape: "MsgSetRuleset(msg_t *, ruleset_t *)" does not free or save its pointer parameter "pMsg".
rsyslog-7.4.10/plugins/imudp/imudp.c:417: noescape: Resource "pMsg" is not freed or pointed-to in function "MsgSetFlowControlType(msg_t *, flowControl_t)".
rsyslog-7.4.10/runtime/msg.c:1755:30: noescape: "MsgSetFlowControlType(msg_t *, flowControl_t)" does not free or save its pointer parameter "pMsg".
rsyslog-7.4.10/plugins/imudp/imudp.c:421: noescape: Resource "pMsg" is not freed or pointed-to in function "msgSetFromSockinfo(msg_t *, struct sockaddr_storage *)".
rsyslog-7.4.10/runtime/msg.c:2229:27: noescape: "msgSetFromSockinfo(msg_t *, struct sockaddr_storage *)" does not free or save its pointer parameter "pThis".
rsyslog-7.4.10/plugins/imudp/imudp.c:436: leaked_storage: Variable "pMsg" going out of scope leaks the storage it points to.
2014-07-11 15:19:44 +02:00
Tomas Heinrich
fd25f5e04c bugfix: add a missing cleanup in case of an error
Error: RESOURCE_LEAK (CWE-772):
rsyslog-7.4.10/plugins/imudp/imudp.c:260: alloc_fn: Storage is returned from allocation function "malloc(size_t)".
rsyslog-7.4.10/plugins/imudp/imudp.c:260: var_assign: Assigning: "newlcnfinfo" = storage returned from "malloc(56UL)".
rsyslog-7.4.10/plugins/imudp/imudp.c:307: leaked_storage: Variable "newlcnfinfo" going out of scope leaks the storage it points to.
2014-07-11 15:19:44 +02:00
Tomas Heinrich
f12d0c599f bugfix: prevent leaking a socket in case of an error
Error: RESOURCE_LEAK (CWE-772):
rsyslog-7.4.10/plugins/imptcp/imptcp.c:1252: open_arg: "AcceptConnReq(ptcplstn_t *, int *, prop_t **, prop_t **)" opens handle stored into "newSock".
rsyslog-7.4.10/plugins/imptcp/imptcp.c:615:2: open_fn: Returning handle opened by function "accept(int, __SOCKADDR_ARG, socklen_t * restrict)".
rsyslog-7.4.10/plugins/imptcp/imptcp.c:615:2: var_assign: Assigning: "iNewSock" = "accept(pLstn->sock, __SOCKADDR_ARG({ .__sockaddr__ = (struct sockaddr *)&addr}), &addrlen)".
rsyslog-7.4.10/plugins/imptcp/imptcp.c:623:3: noescape: Resource "iNewSock" is not freed or pointed-to in function "EnableKeepAlive(ptcplstn_t *, int)".
rsyslog-7.4.10/plugins/imptcp/imptcp.c:535:40: noescape: "EnableKeepAlive(ptcplstn_t *, int)" does not free or save its handle parameter "sock".
rsyslog-7.4.10/plugins/imptcp/imptcp.c:629:2: noescape: Resource "iNewSock" is not freed or pointed-to in function "fcntl(int, int, ...)".
rsyslog-7.4.10/plugins/imptcp/imptcp.c:634:3: noescape: Resource "iNewSock" is not freed or pointed-to in function "fcntl(int, int, ...)".
rsyslog-7.4.10/plugins/imptcp/imptcp.c:641:2: var_assign: Assigning: "*newSock" = "iNewSock".
rsyslog-7.4.10/plugins/imptcp/imptcp.c:1260: leaked_handle: Handle variable "newSock" going out of scope leaks the handle.
2014-07-11 15:19:44 +02:00
Tomas Heinrich
b4329a2c23 bugfix: plug more memleaks in imptcp
Error: RESOURCE_LEAK (CWE-772):
rsyslog-7.4.10/plugins/imptcp/imptcp.c:1120: alloc_fn: Storage is returned from allocation function "malloc(size_t)".
rsyslog-7.4.10/plugins/imptcp/imptcp.c:1120: var_assign: Assigning: "pSrv" = storage returned from "malloc(136UL)".
rsyslog-7.4.10/plugins/imptcp/imptcp.c:1159: leaked_storage: Variable "pSrv" going out of scope leaks the storage it points to.
2014-07-11 15:19:44 +02:00
Tomas Heinrich
e4d0e1b8e4 bugfix: plug more memleaks in imptcp 2014-07-11 15:19:44 +02:00
Tomas Heinrich
6d1eab822a bugfix: don't add session to the server upon failure
The session should be added after everything else is completed.
2014-07-11 15:19:44 +02:00
Tomas Heinrich
88c9c3054f bugfix: plug more memleaks in imptcp
Error: RESOURCE_LEAK (CWE-772):
rsyslog-7.4.10/plugins/imptcp/imptcp.c:964: alloc_fn: Storage is returned from allocation function "malloc(size_t)".
rsyslog-7.4.10/plugins/imptcp/imptcp.c:964: var_assign: Assigning: "pSess" = storage returned from "malloc(88UL)".
rsyslog-7.4.10/plugins/imptcp/imptcp.c:987: leaked_storage: Variable "pSess" going out of scope leaks the storage it points to.
2014-07-11 15:19:44 +02:00
Tomas Heinrich
106d19ae53 bugfix: don't add listener to the server upon failure
The listener should be added after everything else is completed.
2014-07-11 15:19:43 +02:00
Tomas Heinrich
d372830d87 bugfix: plug memleaks in imptcp
Error: RESOURCE_LEAK (CWE-772):
rsyslog-7.4.10/plugins/imptcp/imptcp.c:925: alloc_fn: Storage is returned from allocation function "malloc(size_t)".
rsyslog-7.4.10/plugins/imptcp/imptcp.c:925: var_assign: Assigning: "pLstn" = storage returned from "malloc(56UL)".
rsyslog-7.4.10/plugins/imptcp/imptcp.c:951: leaked_storage: Variable "pLstn" going out of scope leaks the storage it points to.
2014-07-11 15:19:43 +02:00
Tomas Heinrich
a6c4e18780 bugfix: propagate an error code
Previously, the return value was lost as iRet is overwritten in
CHKiRet(). The error code is not handled currently thus the utility is
disputable.
2014-07-11 15:19:43 +02:00
Tomas Heinrich
6d6564f1fd bugfix: add a missing pointer assignment 2014-07-11 15:19:43 +02:00
Tomas Heinrich
226b45feb0 bugfix: remove redundant return 2014-07-11 15:19:43 +02:00
Tomas Heinrich
3b9be747b9 bugfix: plug a memleak 2014-07-11 15:19:43 +02:00
Tomas Heinrich
f0a8468cf5 bugfix: check return value of ratelimitNew() 2014-07-11 15:19:43 +02:00
Tomas Heinrich
b56df5725f bugfix: check return value of calloc() 2014-07-11 15:19:43 +02:00
Tomas Heinrich
2ce6f44c86 bugfix: prevent a double free
cstrConvSzStrAndDestruct() frees it's first argument but doesn't set
it to NULL as rsCStrDestruct() does. In couple of cases the code using
it assumed it does which could have led to double free.
This commit aligns the prototype of cstrConvSzStrAndDestruct() with
rsCStrDestruct(). The callers were updated for the new behavior and
several potential memleaks were plugged.

Error: USE_AFTER_FREE (CWE-825):
rsyslog-7.4.10/runtime/cfsysline.c:532: freed_arg: "cstrConvSzStrAndDestruct(cstr_t *, uchar **, int)" frees "pStrB".
rsyslog-7.4.10/runtime/stringbuf.c:486:2: freed_arg: "free(void *)" frees parameter "pThis".
rsyslog-7.4.10/runtime/cfsysline.c:553: deref_arg: Calling "rsCStrDestruct(cstr_t **)" dereferences freed pointer "pStrB".
rsyslog-7.4.10/runtime/stringbuf.c:216:16: var_assign_parm: Assigning: "pThis" = "*ppThis".
rsyslog-7.4.10/runtime/stringbuf.c:218:2: deref_var: Dereferencing "pThis" (which is a copy of "*ppThis").

Error: USE_AFTER_FREE (CWE-825):
rsyslog-7.4.10/outchannel.c:113: freed_arg: "cstrConvSzStrAndDestruct(cstr_t *, uchar **, int)" frees "pStrB".
rsyslog-7.4.10/runtime/stringbuf.c:486:2: freed_arg: "free(void *)" frees parameter "pThis".
rsyslog-7.4.10/outchannel.c:118: deref_arg: Calling "rsCStrDestruct(cstr_t **)" dereferences freed pointer "pStrB".
rsyslog-7.4.10/runtime/stringbuf.c:216:16: var_assign_parm: Assigning: "pThis" = "*ppThis".
rsyslog-7.4.10/runtime/stringbuf.c:218:2: deref_var: Dereferencing "pThis" (which is a copy of "*ppThis").

Error: USE_AFTER_FREE (CWE-825):
rsyslog-7.4.10/outchannel.c:181: freed_arg: "cstrConvSzStrAndDestruct(cstr_t *, uchar **, int)" frees "pStrB".
rsyslog-7.4.10/runtime/stringbuf.c:486:2: freed_arg: "free(void *)" frees parameter "pThis".
rsyslog-7.4.10/outchannel.c:186: deref_arg: Calling "rsCStrDestruct(cstr_t **)" dereferences freed pointer "pStrB".
rsyslog-7.4.10/runtime/stringbuf.c:216:16: var_assign_parm: Assigning: "pThis" = "*ppThis".
rsyslog-7.4.10/runtime/stringbuf.c:218:2: deref_var: Dereferencing "pThis" (which is a copy of "*ppThis").

Error: USE_AFTER_FREE (CWE-825):
rsyslog-7.4.10/template.c:480: freed_arg: "cstrConvSzStrAndDestruct(cstr_t *, uchar **, int)" frees "pStrB".
rsyslog-7.4.10/runtime/stringbuf.c:486:2: freed_arg: "free(void *)" frees parameter "pThis".
rsyslog-7.4.10/template.c:493: deref_arg: Calling "rsCStrDestruct(cstr_t **)" dereferences freed pointer "pStrB".
rsyslog-7.4.10/runtime/stringbuf.c:216:16: var_assign_parm: Assigning: "pThis" = "*ppThis".
rsyslog-7.4.10/runtime/stringbuf.c:218:2: deref_var: Dereferencing "pThis" (which is a copy of "*ppThis").
2014-07-11 15:19:43 +02:00
Tomas Heinrich
5d48f71eb6 bugfix: check return value of malloc() 2014-07-11 15:19:43 +02:00
Tomas Heinrich
3cfde761f6 bugfix: check return value of calloc() 2014-07-11 15:19:43 +02:00
Tomas Heinrich
1c14e33c2b bugfix: check array bounds 2014-07-11 15:19:43 +02:00
Rainer Gerhards
d5de1f4a67 prepare for 8.3.4 v8.3.4 2014-07-11 15:19:23 +02:00
Rainer Gerhards
57202f1341 Merge branch 'v8-stable' 2014-07-11 12:56:29 +02:00
Rainer Gerhards
0439592567 Merge branch 'v7-stable' into v8-stable 2014-07-11 12:56:21 +02:00
Rainer Gerhards
e61d8a88d0 Merge branch 'v7-stable' of git+ssh://git.adiscon.com/git/rsyslog into v7-stable 2014-07-11 12:47:23 +02:00
Rainer Gerhards
df2d8de8c4 fix inconsistent write/deref in action config processing
Thanks to Tomas Heinrich for alerting us.
2014-07-11 12:46:56 +02:00
Rainer Gerhards
6f30d69e10 Merge branch 'v8-stable' 2014-07-11 12:19:50 +02:00
Rainer Gerhards
ff4213524c Merge branch 'v7-stable' into v8-stable
Conflicts:
	action.c
2014-07-11 12:19:41 +02:00
Rainer Gerhards
4fb66f5c04 maintain ChangeLog 2014-07-11 12:04:16 +02:00
Rainer Gerhards
089a7ba9f2 unpick commit 5c4cb78ac15e841726af672a8a227017a2516cfa
The variable initialized there was removed by my larger patch
a couple of days ago. Accidently cherry-picked that commit.
2014-07-11 11:53:16 +02:00
Tomas Heinrich
69bb859fdc bugfix: relax a too strict condition 2014-07-11 11:50:28 +02:00
Tomas Heinrich
bbe7382ffc bugfix: prevent division by zero
The result is set to 0 in that case. Might be better to do something
else in the future, but at least it'll stop crashing for now.
2014-07-11 11:50:28 +02:00
Tomas Heinrich
a171072f2b bugfix: prevent passing NULL to strstr, strlen 2014-07-11 11:50:28 +02:00
Tomas Heinrich
dfdb4e20b2 Use uchar instead of char for type size reference 2014-07-11 11:50:28 +02:00
Tomas Heinrich
4332f88bd9 bugfix: allocate correct object type 2014-07-11 11:50:28 +02:00
Tomas Heinrich
1267ee2879 Set default value of eParamPassing explicitly 2014-07-11 11:50:27 +02:00
Tomas Heinrich
ba4cc3298c bugfix: add a missing flag and prevent memleak 2014-07-11 11:49:22 +02:00
Tomas Heinrich
b43b16901e bugfix: correct variable mismatch 2014-07-11 11:49:22 +02:00
Tomas Heinrich
28277f723e bugfix: don't export uninitialized data 2014-07-11 11:49:22 +02:00
Tomas Heinrich
dcb201eae6 bugfix: remove duplicate code 2014-07-11 11:49:22 +02:00
Rainer Gerhards
4a05df7d64 Merge branch 'v8-stable'
Conflicts:
	runtime/syslogd-types.h
2014-07-11 10:42:14 +02:00
Rainer Gerhards
cbf6746b64 make build on older gcc versions 2014-07-11 10:07:15 +02:00
Rainer Gerhards
15c051dfb6 Merge branch 'v7-stable' into v8-stable 2014-07-11 09:27:58 +02:00
Rainer Gerhards
499b3c7426 fix small memleak in action()
This was introduced by a recent patch. Not present in any
released version.
2014-07-11 09:27:30 +02:00