30 Commits

Author SHA1 Message Date
Rainer Gerhards
8a8675b223 fix compiler warnings 2016-06-02 10:18:05 +02:00
Rainer Gerhards
1274eced88 stringbuf refactor: combine two almost identical functions 2016-05-19 12:34:26 +02:00
Rainer Gerhards
16a22f9eff stringbuf refactor: interface change for cstrTrimTrailingWhiteSpace() 2016-05-19 11:09:24 +02:00
Rainer Gerhards
f8738727f9 change cstrFinalize() interface
the function can no longer fail and it is not expected that this
will ever happen again in the future. So we remove the return value,
giving a small speedup to the code.
2016-05-19 10:49:37 +02:00
Rainer Gerhards
cf9ff7c2b0 stringbuf: remove no longer needed functions
... and some additional minor cleanup while going along
2016-05-19 10:40:36 +02:00
Rainer Gerhards
0a1117b43e cleanup 2016-05-19 08:39:50 +02:00
Rainer Gerhards
f097aa2e69 cleanup comments 2016-05-19 08:34:14 +02:00
Rainer Gerhards
d3ef5a7bde refactor stringbuf: use only a single string buffer
... both for the internal representation as well as the C-String one.
The module originally tried to support embedded NUL characters, which
over time has prooven to be not necessary. Rsyslog always encodes
NUL into escape sequences.

Also, the dual buffers were used inconsistently, which could lead to
subtle bugs. With the single buffer, this does no longer happen and
we also get some improved performance (should be noticable)
and reduced memory use (a bit).

closes https://github.com/rsyslog/rsyslog/issues/1033
2016-05-18 11:38:55 +02:00
Janmejay Singh
90019a681a dyn-stats values are now reported (in json, json-es and cee formats) under a key "values" 2016-03-31 00:16:17 +05:30
Rainer Gerhards
ed9d9c52bf finally remove no longer needed rsCStrGetSzStr() function 2016-01-12 08:20:31 -05:30
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
Rainer Gerhards
f7ad21626f silence compiler warnings
mostly cosmetic things
2014-03-16 10:52:54 +01:00
Rainer Gerhards
2fe58f67a9 remove obsolete function 2013-10-18 09:13:56 +02:00
Rainer Gerhards
bcc0f0ae4d bugfix: invalid addressing in string class (recent regression) 2013-05-13 08:23:17 +02:00
Tomas Heinrich
9959f80ee6 Add new string functions that take a printf-style fmt 2013-04-09 17:20:29 +02:00
Rainer Gerhards
ac9afc4149 Merge branch 'v5-stable' into master
Conflicts:
	ChangeLog
	action.h
	configure.ac
	doc/manual.html
	plugins/immark/immark.c
	plugins/impstats/impstats.c
	plugins/imptcp/imptcp.c
	plugins/imtcp/imtcp.c
	runtime/cfsysline.c
	runtime/cfsysline.h
	runtime/conf.c
	runtime/ctok.c
	runtime/ctok.h
	runtime/ctok_token.c
	runtime/ctok_token.h
	runtime/dnscache.h
	runtime/expr.c
	runtime/expr.h
	runtime/rule.c
	runtime/rule.h
	runtime/ruleset.h
	runtime/sysvar.c
	runtime/vm.h
	runtime/vmop.c
	runtime/vmop.h
	runtime/vmprg.c
	runtime/vmprg.h
	runtime/vmstk.c
	runtime/vmstk.h
	tools/omusrmsg.c
2012-01-18 14:08:24 +01:00
Rainer Gerhards
f6dea36394 runtime license change 2012-01-16 12:39:01 +01:00
Rainer Gerhards
4618773be6 milestone: added support for CEE-variables to RainerScript 2010-12-03 17:11:03 +01:00
Rainer Gerhards
de84a12f8a introduced the idea of detached properties
some things inside the message can be used over a large number of
messages and need to to be allocated and re-written every time. I now
begin to implement this as a "prop_t" object, first use for the inputName.
Some input modules are already converted, some others to go. Will do
a little performance check on the new method before I go further.

Also, this commit has some cleanup and a few bug fixes that prevented
compiliation in debug mode (I overlooked this as I did not compile
for debug, what I normally do, and the automatted test also does not
do that)
2009-06-29 16:53:26 +02:00
Rainer Gerhards
7ea63db2f9 optimization: propert names are now internally identified by integers 2009-06-26 15:31:40 +02:00
Rainer Gerhards
1f361c5eb9 some optimization, declared some frequently called small stringbuf functions inline 2009-06-26 14:22:00 +02:00
Rainer Gerhards
464dcf2339 some more stringbuffer optimization 2009-06-25 18:44:48 +02:00
Rainer Gerhards
3abf567d2b optimized template string generation 2009-06-19 16:07:17 +02:00
Rainer Gerhards
d2d54013ae going forward in moving string-handling functions to new interface... 2009-06-17 15:22:13 +02:00
Rainer Gerhards
f7579e68a6 done various optimizations to the stringbuf and its users 2009-06-16 11:36:05 +02:00
Rainer Gerhards
4ab540e3ba fully integrated regex patch
Now have removed the previous method, as really nobody should call
it any longer (and now nobody does ;)). Also did some other cleanup.
2009-04-02 17:54:48 +02:00
Rainer Gerhards
1d16216aa3 streamlined regex patch
- abided to code conventions
- fixed a potential segfault when regex library can not
  be loaded
2009-04-02 16:51:53 +02:00
Rainer Gerhards
a86e42028a improved performance of regexp-based filters
Thanks to Arnaud Cornet for providing the idea and initial patch.
2009-04-02 16:16:57 +02:00
Rainer Gerhards
5005bce387 added ERE support in filter conditions
new comparison operation "ereregex"
2009-03-04 18:22:48 +01:00
Rainer Gerhards
8f8f65abb6 moved files to the runtime
there are still some files left which could go into the
runtime, but I think we will delete most of them once we
are done with the full modularization.
2008-04-16 10:26:54 +02:00