fix variables' type conversion in expression-based filters (#485937)

This commit is contained in:
Tomas Heinrich 2009-03-18 12:13:41 +00:00
parent 15be272722
commit 0b11dca908
2 changed files with 39 additions and 1 deletions

View File

@ -0,0 +1,33 @@
diff -up rsyslog-3.21.10/runtime/stringbuf.c.convVar rsyslog-3.21.10/runtime/stringbuf.c
--- rsyslog-3.21.10/runtime/stringbuf.c.convVar 2009-03-13 21:32:55.000000000 +0100
+++ rsyslog-3.21.10/runtime/stringbuf.c 2009-03-13 21:39:09.000000000 +0100
@@ -820,7 +820,7 @@ rsCStrConvertToNumber(cstr_t *pStr, numb
/* TODO: octal? hex? */
n = 0;
while(i < pStr->iStrLen && isdigit(pStr->pBuf[i])) {
- n = n * 10 + pStr->pBuf[i] * 10;
+ n = n * 10 + pStr->pBuf[i] - '0';
++i;
}
diff -up rsyslog-3.21.10/runtime/var.c.convVar rsyslog-3.21.10/runtime/var.c
--- rsyslog-3.21.10/runtime/var.c.convVar 2009-03-13 00:31:48.000000000 +0100
+++ rsyslog-3.21.10/runtime/var.c 2009-03-13 00:44:51.000000000 +0100
@@ -366,7 +366,7 @@ ConvForOperation(var_t *pThis, var_t *pO
case VARTYPE_NUMBER:
/* check if we can convert pThis to a number, if so use number format. */
iRet = ConvToNumber(pThis);
- if(iRet != RS_RET_NOT_A_NUMBER) {
+ if(iRet == RS_RET_NOT_A_NUMBER) {
CHKiRet(ConvToString(pOther));
} else {
FINALIZE; /* OK or error */
@@ -384,7 +384,7 @@ ConvForOperation(var_t *pThis, var_t *pO
break;
case VARTYPE_STR:
iRet = ConvToNumber(pOther);
- if(iRet != RS_RET_NOT_A_NUMBER) {
+ if(iRet == RS_RET_NOT_A_NUMBER) {
CHKiRet(ConvToString(pThis));
} else {
FINALIZE; /* OK or error */

View File

@ -3,7 +3,7 @@
Summary: Enhanced system logging and kernel message trapping daemons Summary: Enhanced system logging and kernel message trapping daemons
Name: rsyslog Name: rsyslog
Version: 3.21.10 Version: 3.21.10
Release: 2%{?dist} Release: 3%{?dist}
License: GPLv3+ License: GPLv3+
Group: System Environment/Daemons Group: System Environment/Daemons
URL: http://www.rsyslog.com/ URL: http://www.rsyslog.com/
@ -12,6 +12,7 @@ Source1: rsyslog.init
Source2: rsyslog.conf Source2: rsyslog.conf
Source3: rsyslog.sysconfig Source3: rsyslog.sysconfig
Source4: rsyslog.log Source4: rsyslog.log
Patch0: rsyslog-3.21.10-convVar.patch
BuildRequires: zlib-devel BuildRequires: zlib-devel
BuildRequires: autoconf automake BuildRequires: autoconf automake
Requires: logrotate >= 3.5.2 Requires: logrotate >= 3.5.2
@ -87,6 +88,7 @@ IETF standard protocol.
%prep %prep
%setup -q %setup -q
%patch0 -p1 -b .convVar
%build %build
export CFLAGS="$RPM_OPT_FLAGS -DSYSLOGD_PIDNAME=\\\"syslogd.pid\\\"" export CFLAGS="$RPM_OPT_FLAGS -DSYSLOGD_PIDNAME=\\\"syslogd.pid\\\""
@ -192,6 +194,9 @@ fi
%{_libdir}/rsyslog/lmnsd_gtls.so %{_libdir}/rsyslog/lmnsd_gtls.so
%changelog %changelog
* Wed Mar 18 2009 Tomas Heinrich <theinric@redhat.com> 3.21.10-3
- fix variables' type conversion in expression-based filters (#485937)
* Wed Feb 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.21.10-2 * Wed Feb 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.21.10-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild