diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2013-01-07 15:27:27 +0100 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2013-01-07 15:27:27 +0100 |
commit | 5cd9b52ea5a75c4dff3d92683ff51d4e02cb1fd5 (patch) | |
tree | a119010cb7a8aa7ae5e739e09536dfcc8641f23b /runtime/msg.c | |
parent | cac0a1efdc9ce79b4503431d07075b932a6dcdb2 (diff) | |
download | rsyslog-5cd9b52ea5a75c4dff3d92683ff51d4e02cb1fd5.tar.gz rsyslog-5cd9b52ea5a75c4dff3d92683ff51d4e02cb1fd5.tar.bz2 rsyslog-5cd9b52ea5a75c4dff3d92683ff51d4e02cb1fd5.zip |
bugfix: very large memory consumption (and probably out of memory)
...when FromPos was specified in template, but ToPos not.
Thanks to Radu Gheorghe for alerting us of this bug.
Diffstat (limited to 'runtime/msg.c')
-rw-r--r-- | runtime/msg.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/runtime/msg.c b/runtime/msg.c index 09f6d649..10605ba4 100644 --- a/runtime/msg.c +++ b/runtime/msg.c @@ -3027,6 +3027,8 @@ uchar *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe, */ ; /*DO NOTHING*/ } else { + if(iTo > bufLen) /* iTo is very large, if no to-position is set in the template! */ + iTo = bufLen; iLen = iTo - iFrom + 1; /* the +1 is for an actual char, NOT \0! */ pBufStart = pBuf = MALLOC((iLen + 1) * sizeof(char)); if(pBuf == NULL) { |