7705 Commits

Author SHA1 Message Date
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
Rainer Gerhards
62c26362b3 Merge branch 'v7-stable' into v8-stable
Conflicts:
	action.c

I needed to adopt the v7 changes to the new non-batch inner
processing. This may have some bug potential.
2014-07-10 19:42:57 +02:00
Rainer Gerhards
68785745f2 maintain ChangeLog 2014-07-10 18:51:44 +02:00
Rainer Gerhards
78eb094a9f Merge branch 'v7-stable-act-tpl-passing-mode' into v7-stable
Conflicts:
	ChangeLog
2014-07-10 08:30:29 +02:00
Rainer Gerhards
06804bd370 fix cosmetic mem leak in tzinfo infrastructure
it's cosmetic, because it happens only during shutdown, so the OS
clean up a microsecond later in any case. But good to solve this
for valgrind AND future extensions.
2014-07-09 19:39:48 +02:00
Rainer Gerhards
56b17e6a81 make datetime parser use new tzinfo infrastructure
also do some additons/modifications to infrastructure
2014-07-09 19:34:12 +02:00
Rainer Gerhards
d426ac4af2 new tzinfo config object -- permits to define time zone offsets 2014-07-09 19:11:59 +02:00
Rainer Gerhards
09b4492f0a Merge branch 'master' into master-timezone-def
Conflicts:
	grammar/lexer.l
	grammar/rainerscript.h
2014-07-09 15:01:23 +02:00
Rainer Gerhards
5cba7d2f55 Merge branch 'v7-stable' into v8-stable 2014-07-09 11:56:44 +02:00
Rainer Gerhards
84f984f5b5 bugfix: double-free when ruleset() parser parameters were used
While unlikely, this could cause stability issues even after the
config phase.
2014-07-09 11:56:18 +02:00