summaryrefslogtreecommitdiffstats
path: root/runtime/msg.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2013-03-29 16:09:19 +0100
committerRainer Gerhards <rgerhards@adiscon.com>2013-03-29 16:09:19 +0100
commit7b45d0b4d2caa27df4835ca59617bd869ee34442 (patch)
treed30fbc00ca571f050c60eeede91a62fab8684136 /runtime/msg.c
parent1b2f93da31d0331244aa7c72068f4ec324e2cb71 (diff)
parent474877b9d7912a3d2abc2a350dbc41e4c3b050e4 (diff)
downloadrsyslog-7b45d0b4d2caa27df4835ca59617bd869ee34442.tar.gz
rsyslog-7b45d0b4d2caa27df4835ca59617bd869ee34442.tar.bz2
rsyslog-7b45d0b4d2caa27df4835ca59617bd869ee34442.zip
Merge branch 'v7-stable-info'
Conflicts: ChangeLog template.c
Diffstat (limited to 'runtime/msg.c')
-rw-r--r--runtime/msg.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/runtime/msg.c b/runtime/msg.c
index c302a050..1e61e632 100644
--- a/runtime/msg.c
+++ b/runtime/msg.c
@@ -3230,13 +3230,20 @@ uchar *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe,
uchar *pSb;
iFrom = pTpe->data.field.iFromPos;
iTo = pTpe->data.field.iToPos;
- /* need to zero-base to and from (they are 1-based!) */
- if(iFrom > 0)
- --iFrom;
- if(iTo > 0)
- --iTo;
if(bufLen == -1)
bufLen = ustrlen(pRes);
+dbgprintf("DDDD: orginal iFrom %u, iTo %u, len %u\n", iFrom, iTo, bufLen);
+ if(pTpe->data.field.options.bFromPosEndRelative) {
+ iFrom = (bufLen < iFrom) ? 0 : bufLen - iFrom;
+ iTo = (bufLen < iTo)? 0 : bufLen - iTo;
+dbgprintf("DDDD: now iFrom %u, iTo %u\n", iFrom, iTo);
+ } else {
+ /* need to zero-base to and from (they are 1-based!) */
+ if(iFrom > 0)
+ --iFrom;
+ if(iTo > 0)
+ --iTo;
+ }
if(iFrom == 0 && iTo >= bufLen) {
/* in this case, the requested string is a superset of what we already have,
* so there is no need to do any processing. This is a frequent case for size-limited