Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package rsyslog for openSUSE:Factory checked 
in at 2026-11-19 16:54:08
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rsyslog (Old)
 and      /work/SRC/openSUSE:Factory/.rsyslog.new.1251 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "rsyslog"

Thu Nov 19 16:54:08 2026 rev:197 rq:1398457 version:8.2608.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/rsyslog/rsyslog.changes  2026-11-16 
09:11:04.307342480 +0100
+++ /work/SRC/openSUSE:Factory/.rsyslog.new.1251/rsyslog.changes        
2026-11-19 16:54:33.575370388 +0100
@@ -1,0 +2,35 @@
+Wed Nov 18 14:38:12 UTC 2026 - Thomas Blume <[email protected]>
+
+- fix several security bugs
+  * 0001-CVE-2026-129829-rsyslog-imuxsock-system-timestamp-ou.patch
+    (bsc#1290100)
+  * 0002-CVE-2026-129831-rsyslog-imuxsock-PRI-digit-accumulat.patch
+    (bsc#1290099)
+  * 0003-CVE-2026-129830-rsyslog-imuxsock-TAG-parser-out-of-b.patch
+    (bsc#1290098)
+  * 0004-CVE-2026-129832-rsyslog-local-denial-of-service-vuln.patch
+    (bsc#1290529)
+  * 0005-CVE-2026-129833-rsyslog-mmanon-embedded-IPv4-in-IPv6.patch
+    (bsc#1290530)
+  * 0006-CVE-2026-129836-rsyslog-imdtls-incomplete-handshake-.patch
+    cumulative patch for:
+    (CVE-2026-129834 bsc#1290531 CVE-2026-129835 bsc#1290532 bsc#1290533)
+  * 0007-CVE-2026-129838-rsyslog-imuxsock-trusted-property-at.patch
+    (bsc#1290535)
+  * 0008-CVE-2026-129839-rsyslog-template-JSON-escaping-defec.patch
+    (bsc#1290536)
+  * 0009-CVE-2026-129837-rsyslog-weekday-formatting-crash-bsc.patch
+    (bsc#1290534)
+
+- VUL-0: rsyslog: RainerScript replace() length wrap (bsc#1285036)
+  * add 0001-rainerscript-bound-replace-and-wrap-results.patch 
+- - fix RainerScript replace() heap buffer overflow (bsc#1275926)
+  * add 0001-rainerscript-align-replace-sizing-rewind.patch
+
+remove: 
+  * 0001-imdtls-reject-clients-that-fail-peer-verification.patch 
+    (replaced by 
0006-CVE-2026-129836-rsyslog-imdtls-incomplete-handshake-.patch)
+  * 0001-fix-RainerScript-replace-heap-buffer-overflow.patch
+    (replaced by 0001-rainerscript-align-replace-sizing-rewind.patch)
+
+-------------------------------------------------------------------

Old:
----
  0001-fix-RainerScript-replace-heap-buffer-overflow.patch
  0001-imdtls-reject-clients-that-fail-peer-verification.patch

New:
----
  0001-CVE-2026-129829-rsyslog-imuxsock-system-timestamp-ou.patch
  0001-rainerscript-align-replace-sizing-rewind.patch
  0001-rainerscript-bound-replace-and-wrap-results.patch
  0002-CVE-2026-129831-rsyslog-imuxsock-PRI-digit-accumulat.patch
  0003-CVE-2026-129830-rsyslog-imuxsock-TAG-parser-out-of-b.patch
  0004-CVE-2026-129832-rsyslog-local-denial-of-service-vuln.patch
  0005-CVE-2026-129833-rsyslog-mmanon-embedded-IPv4-in-IPv6.patch
  0006-CVE-2026-129836-rsyslog-imdtls-incomplete-handshake-.patch
  0007-CVE-2026-129838-rsyslog-imuxsock-trusted-property-at.patch
  0008-CVE-2026-129839-rsyslog-template-JSON-escaping-defec.patch
  0009-CVE-2026-129837-rsyslog-weekday-formatting-crash-bsc.patch

----------(Old B)----------
  Old:    (replaced by 
0006-CVE-2026-129836-rsyslog-imdtls-incomplete-handshake-.patch)
  * 0001-fix-RainerScript-replace-heap-buffer-overflow.patch
    (replaced by 0001-rainerscript-align-replace-sizing-rewind.patch)
  Old:remove: 
  * 0001-imdtls-reject-clients-that-fail-peer-verification.patch 
    (replaced by 
0006-CVE-2026-129836-rsyslog-imdtls-incomplete-handshake-.patch)
----------(Old E)----------

----------(New B)----------
  New:- fix several security bugs
  * 0001-CVE-2026-129829-rsyslog-imuxsock-system-timestamp-ou.patch
    (bsc#1290100)
  New:- - fix RainerScript replace() heap buffer overflow (bsc#1275926)
  * add 0001-rainerscript-align-replace-sizing-rewind.patch
  New:- VUL-0: rsyslog: RainerScript replace() length wrap (bsc#1285036)
  * add 0001-rainerscript-bound-replace-and-wrap-results.patch 
- - fix RainerScript replace() heap buffer overflow (bsc#1275926)
  New:    (bsc#1290100)
  * 0002-CVE-2026-129831-rsyslog-imuxsock-PRI-digit-accumulat.patch
    (bsc#1290099)
  New:    (bsc#1290099)
  * 0003-CVE-2026-129830-rsyslog-imuxsock-TAG-parser-out-of-b.patch
    (bsc#1290098)
  New:    (bsc#1290098)
  * 0004-CVE-2026-129832-rsyslog-local-denial-of-service-vuln.patch
    (bsc#1290529)
  New:    (bsc#1290529)
  * 0005-CVE-2026-129833-rsyslog-mmanon-embedded-IPv4-in-IPv6.patch
    (bsc#1290530)
  New:    (bsc#1290530)
  * 0006-CVE-2026-129836-rsyslog-imdtls-incomplete-handshake-.patch
    cumulative patch for:
  New:    (CVE-2026-129834 bsc#1290531 CVE-2026-129835 bsc#1290532 bsc#1290533)
  * 0007-CVE-2026-129838-rsyslog-imuxsock-trusted-property-at.patch
    (bsc#1290535)
  New:    (bsc#1290535)
  * 0008-CVE-2026-129839-rsyslog-template-JSON-escaping-defec.patch
    (bsc#1290536)
  New:    (bsc#1290536)
  * 0009-CVE-2026-129837-rsyslog-weekday-formatting-crash-bsc.patch
    (bsc#1290534)
----------(New E)----------

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ rsyslog.spec ++++++
--- /var/tmp/diff_new_pack.QLlx8o/_old  2026-11-19 16:54:34.795422103 +0100
+++ /var/tmp/diff_new_pack.QLlx8o/_new  2026-11-19 16:54:34.797422188 +0100
@@ -236,9 +236,18 @@
 Source18:       firewall.frule
 Source19:       NetworkManager.frule
 Source20:       rsyslog-tmpfiles.conf
-Patch1:         0001-fix-RainerScript-replace-heap-buffer-overflow.patch
-Patch2:         0001-imdtls-reject-clients-that-fail-peer-verification.patch
-Patch3:         0001-fix-CVE-2026-93404-rsyslog-omclickhouse-SQL-injectio.patch
+Patch1:         0001-rainerscript-align-replace-sizing-rewind.patch
+Patch3:         0001-rainerscript-bound-replace-and-wrap-results.patch
+Patch4:         0001-fix-CVE-2026-93404-rsyslog-omclickhouse-SQL-injectio.patch
+Patch5:         0001-CVE-2026-129829-rsyslog-imuxsock-system-timestamp-ou.patch
+Patch6:         0002-CVE-2026-129831-rsyslog-imuxsock-PRI-digit-accumulat.patch
+Patch7:         0003-CVE-2026-129830-rsyslog-imuxsock-TAG-parser-out-of-b.patch
+Patch8:         0004-CVE-2026-129832-rsyslog-local-denial-of-service-vuln.patch
+Patch9:         0005-CVE-2026-129833-rsyslog-mmanon-embedded-IPv4-in-IPv6.patch
+Patch10:        0006-CVE-2026-129836-rsyslog-imdtls-incomplete-handshake-.patch
+Patch11:        0007-CVE-2026-129838-rsyslog-imuxsock-trusted-property-at.patch
+Patch12:        0008-CVE-2026-129839-rsyslog-template-JSON-escaping-defec.patch
+Patch13:        0009-CVE-2026-129837-rsyslog-weekday-formatting-crash-bsc.patch
 
 # this is a dirty hack since % dir does only work for the specified directory 
and nothing above
 # but I want to be able to switch this to /etc/apparmor.d once the profiles 
received more testing

++++++ 0001-CVE-2026-129829-rsyslog-imuxsock-system-timestamp-ou.patch ++++++
>From db6d37021f3ef490344fea69ddafd2becc390ee3 Mon Sep 17 00:00:00 2001
From: Thomas BLume <[email protected]>
Date: Tue, 17 Nov 2026 08:11:07 +0100
Subject: [PATCH 1/8] CVE-2026-129829: rsyslog: imuxsock system-timestamp
 out-of-bounds write (bsc#1290100)

---
 plugins/imuxsock/imuxsock.c | 36 +++++++++++++++++++++---------------
 1 file changed, 21 insertions(+), 15 deletions(-)

diff --git a/plugins/imuxsock/imuxsock.c b/plugins/imuxsock/imuxsock.c
index 1fdf18c19..3f2557e9a 100644
--- a/plugins/imuxsock/imuxsock.c
+++ b/plugins/imuxsock/imuxsock.c
@@ -1099,14 +1099,20 @@ static rsRetVal SubmitMsg(uchar *pRcv, int lenRcv, 
lstn_t *pLstn, struct ucred *
         pMsg->msgFlags = pLstn->flags;
     }
 
-    if (pLstn->bUseSpecialParser) {
+    if (pLstn->bUseSpecialParser && priValid) {
         /* this is the legacy "log socket" parser which was written on the 
assumption
          * that the log socket format would be fixed. While many folks said 
so, it
          * seems to be different in practice, and this is why we now have 
choices...
          * rgerhards, 2015-03-03
          */
-        parser.SanitizeMsg(pMsg);
-        lenMsg = pMsg->iLenRawMsg - offs; /* SanitizeMsg() may have changed 
the size */
+        CHKiRet(parser.SanitizeMsg(pMsg));
+        /* Sanitizing may shorten the raw message. Never reuse a PRI cursor
+         * outside the current representation. */
+        if (offs >= pMsg->iLenRawMsg) {
+            pMsg->msgFlags |= NEEDS_PARSING;
+            goto submit;
+        }
+        lenMsg = pMsg->iLenRawMsg - offs;
         parse = pMsg->pszRawMsg + offs;
         msgSetPRI(pMsg, pri);
         MsgSetAfterPRIOffs(pMsg, priValid ? offs + 1 : 0);
@@ -1130,17 +1136,17 @@ static rsRetVal SubmitMsg(uchar *pRcv, int lenRcv, 
lstn_t *pLstn, struct ucred *
                 }
             }
         } else { /* if we pulled the time from the system, we need to update 
the message text */
-            uchar *tmpParse = parse; /* just to check correctness of TS */
-            if (datetime.ParseTIMESTAMP3339(&dummyTS, &tmpParse, &lenMsg) == 
RS_RET_OK ||
-                datetime.ParseTIMESTAMP3164(&dummyTS, &tmpParse, &lenMsg, 
NO_PARSE3164_TZSTRING,
-                                            NO_PERMIT_YEAR_AFTER_TIME) == 
RS_RET_OK) {
-                /* We modify the message only if it contained a valid 
timestamp,
-                otherwise we do not touch it at all. */
-                datetime.formatTimestamp3164(&st, (char *)parse, 0);
-                parse[15] = ' '; /* re-write \0 from fromatTimestamp3164 by SP 
*/
-                /* update "counters" to reflect processed timestamp */
-                parse += 16;
-            }
+            uchar *tmpParse = parse;
+            const int lenAvail = lenMsg;
+            if ((datetime.ParseTIMESTAMP3339(&dummyTS, &tmpParse, &lenMsg) == 
RS_RET_OK ||
+                 datetime.ParseTIMESTAMP3164(&dummyTS, &tmpParse, &lenMsg, 
NO_PARSE3164_TZSTRING,
+                 NO_PERMIT_YEAR_AFTER_TIME) == RS_RET_OK) &&
+                 lenAvail >= 16) {
+                /* The fixed-width rewrite must fit in the remaining raw 
message. */
+               datetime.formatTimestamp3164(&st, (char *)parse, 0);
+               parse[15] = ' ';
+               parse += 16;
+           }
         }
 
         /* pull tag */
@@ -1157,7 +1163,7 @@ static rsRetVal SubmitMsg(uchar *pRcv, int lenRcv, lstn_t 
*pLstn, struct ucred *
     } else { /* we are configured to use regular parser chain */
         pMsg->msgFlags |= NEEDS_PARSING;
     }
-
+submit:
     MsgSetRcvFrom(pMsg, pLstn->hostName == NULL ? glbl.GetLocalHostNameProp() 
: pLstn->hostName);
     CHKiRet(MsgSetRcvFromIP(pMsg, pLocalHostIP));
     MsgSetRuleset(pMsg, pLstn->pRuleset);
-- 
2.55.0


++++++ 0001-rainerscript-align-replace-sizing-rewind.patch ++++++
>From 667e3f61aec5ee02c5c2ee6f0f8accf6fe4301a9 Mon Sep 17 00:00:00 2001
From: Rainer Gerhards <[email protected]>
Date: Thu, 20 Aug 2026 15:53:16 +0200
Subject: [PATCH] rainerscript: align replace sizing rewind

Why:
The sizing pass skipped a candidate match that the copy pass replaced.

Impact:
Overlapping partial matches now receive a correctly sized output string.

Before/After:
Before, the two passes resumed at different source offsets; after, both
resume at the same offset.

Technical Overview:
Make the sizing pass rewind both its source index and tentative output
length by the full failed partial-match length. This mirrors the copy pass
and ensures that every replacement counted is also written exactly once.
The change preserves the existing empty-find, replacement, and trailing
partial-match behavior.

With the help of AI-Agents: Codex
---
 grammar/rainerscript.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/grammar/rainerscript.c b/grammar/rainerscript.c
index 46d82af18..988035243 100644
--- a/grammar/rainerscript.c
+++ b/grammar/rainerscript.c
@@ -1827,8 +1827,8 @@ static es_str_t *doFuncReplace(struct svar *__restrict__ 
const operandVal,
         if (src_buff[i] == find[j]) {
             j++;
         } else if (j > 0) {
-            i -= (j - 1);
-            lDst -= (j - 1);
+            i -= j;
+            lDst -= j;
             j = 0;
         }
     }
-- 
2.55.0


++++++ 0001-rainerscript-bound-replace-and-wrap-results.patch ++++++
>From 082e933457c57e8aaabd05ca51c10d9f47ed32d3 Mon Sep 17 00:00:00 2001
From: Rainer Gerhards <[email protected]>
Date: Sat, 10 Oct 2026 12:29:07 +0200
Subject: [PATCH] rainerscript: bound replace and wrap results

Why:
Large expansions can overflow the computed output length and corrupt
memory in configurations that expose replacement to message input.

Impact: Oversized results become empty strings with one warning.
Before/After: Unbounded expansion is now capped at maxMessageSize.

Technical Overview:
Use size_t for replacement result sizing.
Reject results above the configured message size before allocation.
Apply the same bound to final wrap concatenation.
Handle rejected results in both expression call sites.
Exercise normal and oversized results through a TCP ruleset.

With the help of AI-Agents: Codex

(cherry picked from commit 0a6901dd6f4f3e6c99097179f1cfeb8e1820bcdc)
---
 grammar/rainerscript.c                | 74 ++++++++++++++++++++++-----
 tests/rscript-replace-result-limit.sh | 36 +++++++++++++
 2 files changed, 96 insertions(+), 14 deletions(-)
 create mode 100755 tests/rscript-replace-result-limit.sh

diff --git a/grammar/rainerscript.c b/grammar/rainerscript.c
index 46d82af18..7123cbea1 100644
--- a/grammar/rainerscript.c
+++ b/grammar/rainerscript.c
@@ -61,6 +61,7 @@
 #include "unicode-helper.h"
 #include "errmsg.h"
 #include "glbl.h"
+#include "atomic.h"
 #ifdef HAVE_LIBYAML
     #include "yamlconf.h"
 #endif
@@ -1802,6 +1803,23 @@ static void doFunc_exec_template(struct cnffunc 
*__restrict__ const func,
     return;
 }
 
+static int resultSizeWarningSent;
+#ifndef HAVE_ATOMIC_BUILTINS
+static DEF_ATOMIC_HELPER_MUT(resultSizeWarningMut) = PTHREAD_MUTEX_INITIALIZER;
+    #define RESULT_SIZE_WARNING_MUT &resultSizeWarningMut
+#else
+    #define RESULT_SIZE_WARNING_MUT NULL
+#endif
+
+static void warnResultSizeLimit(const int limit) {
+    if (ATOMIC_CAS(&resultSizeWarningSent, 0, 1, RESULT_SIZE_WARNING_MUT)) {
+        LogMsg(0, RS_RET_VAL_OUT_OF_RANGE, LOG_WARNING,
+               "RainerScript replace()/wrap() result exceeds maxMessageSize 
(%d bytes); returning an empty string "
+               "(further warnings suppressed)",
+               limit);
+    }
+}
+
 static es_str_t *doFuncReplace(struct svar *__restrict__ const operandVal,
                                struct svar *__restrict__ const findVal,
                                struct svar *__restrict__ const replaceWithVal) 
{
@@ -1814,11 +1832,15 @@ static es_str_t *doFuncReplace(struct svar 
*__restrict__ const operandVal,
     uint lfind = es_strlen(findStr);
     uint lReplaceWith = es_strlen(replaceWithStr);
     uint lSrc = es_strlen(str);
-    uint lDst = 0;
+    size_t lDst = 0;
+    const size_t maxResult = (size_t)glblGetMaxLine(runConf);
+    es_str_t *res;
     uchar *src_buff = es_getBufAddr(str);
     uint i, j;
     for (i = j = 0; i <= lSrc; i++, lDst++) {
+        if (lDst > maxResult) goto oversize;
         if (j == lfind) {
+            if (lReplaceWith > maxResult - (lDst - lfind)) goto oversize;
             lDst = lDst - lfind + lReplaceWith;
             j = 0;
             if (lfind == 0) break;
@@ -1832,7 +1854,8 @@ static es_str_t *doFuncReplace(struct svar *__restrict__ 
const operandVal,
             j = 0;
         }
     }
-    es_str_t *res = es_newStr(lDst);
+    res = es_newStr((es_size_t)lDst);
+    if (res == NULL) goto done;
     unsigned char *dest = es_getBufAddr(res);
     uint k, s;
     for (i = j = s = 0; i <= lSrc; i++, s++) {
@@ -1857,7 +1880,14 @@ static es_str_t *doFuncReplace(struct svar *__restrict__ 
const operandVal,
     if (j > 0) {
         for (k = 1; k <= j; k++) dest[s - k] = src_buff[i - k];
     }
-    res->lenStr = lDst;
+    res->lenStr = (es_size_t)lDst;
+    goto done;
+
+oversize:
+    warnResultSizeLimit((int)maxResult);
+    res = NULL;
+
+done:
     if (freeOperand) es_deleteStr(str);
     if (freeFind) es_deleteStr(findStr);
     if (freeReplacement) es_deleteStr(replaceWithStr);
@@ -2491,6 +2521,7 @@ static void ATTR_NONNULL() doFunct_Replace(struct cnffunc 
*__restrict__ const fu
     cnfexprEval(func->expr[1], &srcVal[1], usrptr, pWti);
     cnfexprEval(func->expr[2], &srcVal[2], usrptr, pWti);
     ret->d.estr = doFuncReplace(&srcVal[0], &srcVal[1], &srcVal[2]);
+    if (ret->d.estr == NULL) ret->d.estr = es_newStr(0);
     ret->datatype = 'S';
     varFreeMembers(&srcVal[0]);
     varFreeMembers(&srcVal[1]);
@@ -2504,8 +2535,10 @@ static void ATTR_NONNULL() doFunct_Wrap(struct cnffunc 
*__restrict__ const func,
     struct svar sourceVal;
     struct svar wrapperVal;
     struct svar escaperVal;
-    int freeSource, freeWrapper;
+    int freeSource, freeWrapper = 0;
     es_str_t *sourceStr;
+    es_str_t *wrapperStr = NULL;
+    es_str_t *res;
 
     cnfexprEval(func->expr[0], &sourceVal, usrptr, pWti);
     cnfexprEval(func->expr[1], &wrapperVal, usrptr, pWti);
@@ -2513,26 +2546,39 @@ static void ATTR_NONNULL() doFunct_Wrap(struct cnffunc 
*__restrict__ const func,
         cnfexprEval(func->expr[2], &escaperVal, usrptr, pWti);
         sourceStr = doFuncReplace(&sourceVal, &wrapperVal, &escaperVal);
         freeSource = 1;
+        if (sourceStr == NULL) {
+            res = es_newStr(0);
+            goto done;
+        }
 
     } else {
         sourceStr = var2String(&sourceVal, &freeSource);
     }
-    es_str_t *wrapperStr = var2String(&wrapperVal, &freeWrapper);
+    wrapperStr = var2String(&wrapperVal, &freeWrapper);
     uchar *src = es_getBufAddr(sourceStr);
     uchar *wrapper = es_getBufAddr(wrapperStr);
     uint lWrapper = es_strlen(wrapperStr);
     uint lSrc = es_strlen(sourceStr);
-    uint totalLen = lSrc + 2 * lWrapper;
-    es_str_t *res = es_newStr(totalLen);
-    uchar *resBuf = es_getBufAddr(res);
-    memcpy(resBuf, wrapper, lWrapper);
-    memcpy(resBuf + lWrapper, src, lSrc);
-    memcpy(resBuf + lSrc + lWrapper, wrapper, lWrapper);
-    res->lenStr = totalLen;
-    if (freeSource) {
+    const uint maxResult = (uint)glblGetMaxLine(runConf);
+    if (lWrapper > maxResult / 2 || lSrc > maxResult - 2 * lWrapper) {
+        warnResultSizeLimit((int)maxResult);
+        res = es_newStr(0);
+    } else {
+        const uint totalLen = lSrc + 2 * lWrapper;
+        res = es_newStr(totalLen);
+        if (res == NULL) goto done;
+        uchar *resBuf = es_getBufAddr(res);
+        memcpy(resBuf, wrapper, lWrapper);
+        memcpy(resBuf + lWrapper, src, lSrc);
+        memcpy(resBuf + lSrc + lWrapper, wrapper, lWrapper);
+        res->lenStr = totalLen;
+    }
+done:
+    if (res == NULL) res = es_newStr(0);
+    if (freeSource && sourceStr != NULL) {
         es_deleteStr(sourceStr);
     }
-    if (freeWrapper) {
+    if (freeWrapper && wrapperStr != NULL) {
         es_deleteStr(wrapperStr);
     }
 
diff --git a/tests/rscript-replace-result-limit.sh 
b/tests/rscript-replace-result-limit.sh
new file mode 100755
index 000000000..a1ec86945
--- /dev/null
+++ b/tests/rscript-replace-result-limit.sh
@@ -0,0 +1,36 @@
+#!/bin/bash
+# SPDX-License-Identifier: Apache-2.0
+# An accepted input can request a replacement result above maxMessageSize.
+# Empty oversized results, an exact normal result, and one captured internal
+# warning prove the limit without creating a huge string. Clean shutdown
+# rules out a crash.
+. ${srcdir:=.}/diag.sh init
+generate_conf
+add_conf '
+global(maxMessageSize="256")
+template(name="outfmt" type="string"
+         
string="normal=%$.normal%;replace=\"%$.large%\";wrap=\"%$.wrapped%\";wrap2=\"%$.wrapped2%\"\n")
+
+module(load="../plugins/imtcp/.libs/imtcp")
+input(type="imtcp" address="127.0.0.1" port="0" ruleset="replace_limit"
+      listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port")
+
+ruleset(name="replace_limit") {
+    set $.normal = replace("aba", "a", "c");
+    set $.large = replace($msg, "a", "bb");
+    set $.wrapped = wrap($msg, "a", "bb");
+    set $.wrapped2 = wrap($msg, $msg);
+    action(type="omfile" file=`echo $RSYSLOG_OUT_LOG` template="outfmt")
+}
+'
+printf '<13>Oct 10 00:00:00 host tag: ' > "$RSYSLOG_DYNNAME.input"
+printf '%150s' '' | tr ' ' a >> "$RSYSLOG_DYNNAME.input"
+printf '\n' >> "$RSYSLOG_DYNNAME.input"
+
+startup
+tcpflood -m1 -I "$RSYSLOG_DYNNAME.input"
+shutdown_when_empty
+wait_shutdown
+content_check 'normal=cbc;replace="";wrap="";wrap2=""'
+content_count_check 'RainerScript replace()/wrap() result exceeds 
maxMessageSize' 1 "$RSYSLOG_DYNNAME.started"
+exit_test
-- 
2.55.0


++++++ 0002-CVE-2026-129831-rsyslog-imuxsock-PRI-digit-accumulat.patch ++++++
>From 10c18c07278be7829439023abfc9add1fd92fbb4 Mon Sep 17 00:00:00 2001
From: Thomas BLume <[email protected]>
Date: Tue, 17 Nov 2026 08:13:21 +0100
Subject: [PATCH 2/8] CVE-2026-129831: rsyslog: imuxsock PRI digit accumulation
 hardening (bsc#1290099)

---
 plugins/imuxsock/imuxsock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/plugins/imuxsock/imuxsock.c b/plugins/imuxsock/imuxsock.c
index 3f2557e9a..017deb7e7 100644
--- a/plugins/imuxsock/imuxsock.c
+++ b/plugins/imuxsock/imuxsock.c
@@ -937,7 +937,7 @@ static rsRetVal SubmitMsg(uchar *pRcv, int lenRcv, lstn_t 
*pLstn, struct ucred *
     parse++;
     pri = 0;
     priDigitCount = 0;
-    while (offs < lenMsg && isdigit(*parse)) {
+    while (offs < lenMsg && priDigitCount < 3 && isdigit(*parse)) {
         pri = pri * 10 + *parse - '0';
         ++parse;
         ++offs;
-- 
2.55.0


++++++ 0003-CVE-2026-129830-rsyslog-imuxsock-TAG-parser-out-of-b.patch ++++++
>From 379b9a36ffbdc7bc39874463c45b4ebb40f1a24e Mon Sep 17 00:00:00 2001
From: Thomas BLume <[email protected]>
Date: Tue, 17 Nov 2026 08:17:04 +0100
Subject: [PATCH 3/8] CVE-2026-129830: rsyslog: imuxsock TAG parser
 out-of-bounds read (bsc#1290098)

---
 plugins/imuxsock/imuxsock.c | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/plugins/imuxsock/imuxsock.c b/plugins/imuxsock/imuxsock.c
index 017deb7e7..7d936f8ad 100644
--- a/plugins/imuxsock/imuxsock.c
+++ b/plugins/imuxsock/imuxsock.c
@@ -1137,16 +1137,20 @@ static rsRetVal SubmitMsg(uchar *pRcv, int lenRcv, 
lstn_t *pLstn, struct ucred *
             }
         } else { /* if we pulled the time from the system, we need to update 
the message text */
             uchar *tmpParse = parse;
-            const int lenAvail = lenMsg;
-            if ((datetime.ParseTIMESTAMP3339(&dummyTS, &tmpParse, &lenMsg) == 
RS_RET_OK ||
-                 datetime.ParseTIMESTAMP3164(&dummyTS, &tmpParse, &lenMsg, 
NO_PARSE3164_TZSTRING,
-                 NO_PERMIT_YEAR_AFTER_TIME) == RS_RET_OK) &&
-                 lenAvail >= 16) {
-                /* The fixed-width rewrite must fit in the remaining raw 
message. */
-               datetime.formatTimestamp3164(&st, (char *)parse, 0);
-               parse[15] = ' ';
-               parse += 16;
-           }
+            int remaining = lenMsg;
+            if (datetime.ParseTIMESTAMP3339(&dummyTS, &tmpParse, &remaining) 
== RS_RET_OK ||
+                datetime.ParseTIMESTAMP3164(&dummyTS, &tmpParse, &remaining, 
NO_PARSE3164_TZSTRING,
+                                            NO_PERMIT_YEAR_AFTER_TIME) == 
RS_RET_OK) {
+                /* The permissive parsers accept timestamps shorter than the 
fixed
+                 * replacement. Only overwrite bytes belonging to the 
timestamp,
+                 * and keep the parser's cursor paired with its remaining 
length. */
+                if (tmpParse - parse == 16) {
+                    datetime.formatTimestamp3164(&st, (char *)parse, 0);
+                    parse[15] = ' '; /* replace the formatter's terminating 
NUL */
+                }
+                parse = tmpParse;
+                lenMsg = remaining;
+          }
         }
 
         /* pull tag */
-- 
2.55.0


++++++ 0004-CVE-2026-129832-rsyslog-local-denial-of-service-vuln.patch ++++++
>From e80e02a778b392f50888521e09ee19695210b0f5 Mon Sep 17 00:00:00 2001
From: Thomas BLume <[email protected]>
Date: Tue, 17 Nov 2026 08:24:46 +0100
Subject: [PATCH 4/8] CVE-2026-129832: rsyslog: local denial-of-service
 vulnerability in imuxsock's PID rewriting path (bsc#1290529)

---
 plugins/imuxsock/imuxsock.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/plugins/imuxsock/imuxsock.c b/plugins/imuxsock/imuxsock.c
index 7d936f8ad..aba14beb5 100644
--- a/plugins/imuxsock/imuxsock.c
+++ b/plugins/imuxsock/imuxsock.c
@@ -774,10 +774,13 @@ static void fixPID(uchar *bufTAG, int *lenTag, struct 
ucred *cred) {
 
     lenPID = snprintf(bufPID, sizeof(bufPID), "[%lu]:", (unsigned 
long)cred->pid);
 
-    for (i = *lenTag; i >= 0 && bufTAG[i] != '['; --i) /*JUST SKIP*/
+    for (i = *lenTag - 1; i >= 0 && bufTAG[i] != '['; --i) /*JUST SKIP*/
         ;
 
-    if (i < 0) i = *lenTag - 1; /* go right at end of TAG, pid was not present 
(-1 for ':') */
+    if (i < 0) {
+        i = *lenTag;
+        if (i > 0 && bufTAG[i - 1] == ':') --i;
+    }
 
     if (i + lenPID > CONF_TAG_MAXSIZE) return; /* do not touch, as things 
would break */
 
-- 
2.55.0


++++++ 0005-CVE-2026-129833-rsyslog-mmanon-embedded-IPv4-in-IPv6.patch ++++++
>From 5cc29876f62aa4c5d7b8a49f0e40f8d43fbdf4e8 Mon Sep 17 00:00:00 2001
From: Thomas BLume <[email protected]>
Date: Tue, 17 Nov 2026 08:30:03 +0100
Subject: [PATCH 5/8] CVE-2026-129833: rsyslog: mmanon embedded IPv4-in-IPv6
 stack overflow (bsc#1290530)

---
 plugins/mmanon/mmanon.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/plugins/mmanon/mmanon.c b/plugins/mmanon/mmanon.c
index a3077a0e6..0e34008d1 100644
--- a/plugins/mmanon/mmanon.c
+++ b/plugins/mmanon/mmanon.c
@@ -1754,7 +1754,7 @@ static int syntax_embedded(const uchar *const 
__restrict__ buf,
 
     while (*nprocessed < buflen) {
         numLen = isValidHexNum(buf + *nprocessed, buflen - *nprocessed, 
nprocessed, 1);
-        if (numLen > 0) {  // found a valid num
+        if (numLen > 0 && numLen < 5) {  // found a valid IPv6 group
             if ((ipParts == 6 && hadAbbrev) || ipParts > 6) {  // is 6 since 
the first part of
                 // IPv4 will also result in a valid hexvalue
                 isIP = 0;
@@ -1927,7 +1927,9 @@ static void anonEmbedded(wrkrInstanceData_t *pWrkrData, 
uchar **msg, int *pLenMs
 
     int syn = syntax_embedded(*msg + offset, *pLenMsg - offset, &iplen, 
&v4Start);
     if (syn) {
-        assert(iplen < sizeof(address));
+        if (iplen >= sizeof(address)) {
+            return;
+        }
         getip(*msg + offset, iplen, address);
         offset += iplen;
         process_embedded(address, pWrkrData, v4Start);
-- 
2.55.0


++++++ 0006-CVE-2026-129836-rsyslog-imdtls-incomplete-handshake-.patch ++++++
>From 882c83db901153137e855c525b0717b1a2ac2c3b Mon Sep 17 00:00:00 2001
From: Thomas BLume <[email protected]>
Date: Tue, 17 Nov 2026 08:31:22 +0100
Subject: [PATCH 6/8] CVE-2026-129836: rsyslog: imdtls incomplete-handshake
 listener stall (bsc#1290533)

---
 plugins/imdtls/imdtls.c | 144 ++++++++++++++++++++++++++++++++++------
 1 file changed, 124 insertions(+), 20 deletions(-)

diff --git a/plugins/imdtls/imdtls.c b/plugins/imdtls/imdtls.c
index 15751c4a7..20b205f28 100644
--- a/plugins/imdtls/imdtls.c
+++ b/plugins/imdtls/imdtls.c
@@ -33,6 +33,7 @@
 #include <poll.h>
 #include <assert.h>
 #include <time.h>
+#include <limits.h>
 
 // --- Include openssl headers as well
 #include <openssl/ssl.h>
@@ -96,6 +97,10 @@ struct dtlsClient_s {
     SSL *sslClient; /* DTSL (SSL) Client */
     time_t lastActivityTime; /* Last Activity Time */
     int clientfd; /* ClientFD */
+    int peerVerified; /* post-handshake permitted-peer check completed */
+    long verifiedRenegotiations; /* handshake generation covered by 
peerVerified */
+    short pollEvents; /* readiness needed by the handshake */
+    int drainPending; /* continue after the per-client read limit */
 };
 
 // Use typedef to define a type 'dtlsClient_t' based on 'struct dtlsClient_s'
@@ -557,6 +562,32 @@ static void DTLScleanupSession(instanceConf_t *inst, int 
idx) {
     }
     inst->dtlsClients[idx]->sslClient = NULL;
     inst->dtlsClients[idx]->lastActivityTime = 0;
+    inst->dtlsClients[idx]->peerVerified = 0;
+    inst->dtlsClients[idx]->verifiedRenegotiations = 0;
+    inst->dtlsClients[idx]->pollEvents = POLLIN;
+    inst->dtlsClients[idx]->drainPending = 0;
+}
+
+static int DTLSVerifySession(instanceConf_t *inst, int idx) {
+    dtlsClient_t *client = inst->dtlsClients[idx];
+    if (!SSL_is_init_finished(client->sslClient)) {
+        client->peerVerified = 0;
+        return 0;
+    }
+    long renegotiations = SSL_total_renegotiations(client->sslClient);
+    if (client->peerVerified && client->verifiedRenegotiations == 
renegotiations) {
+        return 1;
+    }
+
+    if (imdtls_verify_callback(1, client->sslClient) == 0) {
+        LogMsg(0, RS_RET_NO_ERRCODE, LOG_WARNING, "imdtls: Cert Verify FAILED 
for DTLS client idx (%d)", idx);
+        DTLScleanupSession(inst, idx);
+        return 0;
+    }
+    client->peerVerified = 1;
+    client->verifiedRenegotiations = renegotiations;
+    DBGPRINTF("imdtls: Cert Verify SUCCESS for DTLS client idx (%d)\n", idx);
+    return 1;
 }
 
 static void DTLSAcceptSession(instanceConf_t *inst, int idx) {
@@ -572,7 +603,7 @@ static void DTLSAcceptSession(instanceConf_t *inst, int 
idx) {
         if (ret <= 0) {
             err = SSL_get_error(ssl, ret);
             if (err == SSL_ERROR_WANT_READ || err == SSL_ERROR_WANT_WRITE) {
-                // Non-blocking operation did not complete; retry later
+                inst->dtlsClients[idx]->pollEvents = (err == 
SSL_ERROR_WANT_WRITE) ? POLLIN | POLLOUT : POLLIN;
                 DBGPRINTF("imdtls: SSL_accept didn't complete (%d). Will 
retry.\n", err);
             } else if (err == SSL_ERROR_SYSCALL) {
                 DBGPRINTF("imdtls: SSL_accept failed SSL_ERROR_SYSCALL idx 
(%d), removing client.\n", idx);
@@ -587,17 +618,12 @@ static void DTLSAcceptSession(instanceConf_t *inst, int 
idx) {
         } else {
             DBGPRINTF("imdtls: SSL_accept success idx (%d), adding client.\n", 
idx);
             inst->dtlsClients[idx]->lastActivityTime = time(NULL);
-
-            int status = 1;
-            status = imdtls_verify_callback(status, ssl);
-            if (status == 0) {
-                LogMsg(0, RS_RET_NO_ERRCODE, LOG_WARNING, "imdtls: Cert Verify 
FAILED for DTLS client idx (%d)", idx);
-            } else {
-                DBGPRINTF("imdtls: Cert Verify SUCCESS for DTLS client idx 
(%d)\n", idx);
-            }
+            inst->dtlsClients[idx]->pollEvents = POLLIN;
+            DTLSVerifySession(inst, idx);
         }
     } else {
         DBGPRINTF("imdtls: SSL_get_state for DTLS client idx (%d) is %d\n", 
idx, ret);
+        DTLSVerifySession(inst, idx);
     }
 }
 
@@ -614,26 +640,44 @@ static void DTLSReadClient(instanceConf_t *inst, int idx, 
short revents) {
     int err;
     SSL *ssl = inst->dtlsClients[idx]->sslClient;
     DBGPRINTF("imdtls: DEBUG Check Client activity on index %d.\n", idx);
-    if (revents & POLLIN) {
+    if (revents & (POLLIN | POLLOUT)) {
         if (ssl == NULL) {
             DBGPRINTF("imdtls: DTLSHandleSessions MISSING SSL OBJ for index 
%d.\n", idx);
             return;
         }
+        if (!SSL_is_init_finished(ssl)) {
+            DTLSAcceptSession(inst, idx);
+            ssl = inst->dtlsClients[idx]->sslClient;
+            if (ssl == NULL || !SSL_is_init_finished(ssl)) {
+                return;
+            }
+        }
+        if (!DTLSVerifySession(inst, idx) || !(revents & 
inst->dtlsClients[idx]->pollEvents)) {
+            return;
+        }
         DBGPRINTF("imdtls: Read Client activity on index %d.\n", idx);
         char buf[MAX_DTLS_MSGSIZE];
         int len = 0;
+        int reads = 0;
+        inst->dtlsClients[idx]->drainPending = 0;
         do {
             len = SSL_read(ssl, buf, sizeof(buf) - 1);
             if (len > 0) {
+                inst->dtlsClients[idx]->pollEvents = POLLIN;
+                if (!DTLSVerifySession(inst, idx)) {
+                    return;
+                }
                 buf[len] = '\0';
                 processMsg(inst, inst->dtlsClients[idx], buf, len);
             } else {
                 err = SSL_get_error(ssl, len);
                 if (err == SSL_ERROR_WANT_READ) {
+                    inst->dtlsClients[idx]->pollEvents = POLLIN;
                     DBGPRINTF("imdtls: SSL_ERROR_WANT_READ flush rbio on index 
%d.\n", idx);
                     BIO *rbio = SSL_get_rbio(ssl);
                     BIO_flush(rbio);
                 } else if (err == SSL_ERROR_WANT_WRITE) {
+                    inst->dtlsClients[idx]->pollEvents = POLLIN | POLLOUT;
                     DBGPRINTF("imdtls: SSL_ERROR_WANT_WRITE flush wbio on 
index %d.\n", idx);
                     BIO *wbio = SSL_get_wbio(ssl);
                     BIO_flush(wbio);
@@ -652,7 +696,15 @@ static void DTLSReadClient(instanceConf_t *inst, int idx, 
short revents) {
                     break;
                 }
             }
-        } while (len > 0);
+            ++reads;
+        } while (len > 0 && reads < 32);
+        /* OpenSSL can retain complete DTLS records after the datagram socket
+         * has been drained. Retry once on the next loop after the limit,
+         * even if poll reports no new socket data. A WANT_READ clears this
+         * flag, so an incomplete record cannot spin the event loop. */
+        if (len > 0 && reads == 32) {
+            inst->dtlsClients[idx]->drainPending = 1;
+        }
     }
 }
 
@@ -662,6 +714,8 @@ static void DTLSHandleSessions(instanceConf_t *inst) {
     int optval = 1;
     int fdcount = 0;
     int ret, err;
+    int pollTimeout = -1;
+    time_t now = time(NULL);
     memset(clientIdxByPollSlot, -1, sizeof(clientIdxByPollSlot));
     memset(fds, 0, sizeof(fds));
     fds[0].fd = inst->sockfd;
@@ -680,13 +734,36 @@ static void DTLSHandleSessions(instanceConf_t *inst) {
             fdcount++;
             DBGPRINTF("imdtls: DTLSHandleSessions handle client %d (%d)\n", 
fdcount, clientfd);
             fds[fdcount].fd = clientfd;
-            fds[fdcount].events = POLLIN;
+            fds[fdcount].events = inst->dtlsClients[i]->pollEvents;
             clientIdxByPollSlot[fdcount] = i;
+            if (inst->dtlsClients[i]->drainPending) {
+                pollTimeout = 0;
+            }
+
+            /* A nonblocking DTLS handshake needs its retransmission timer
+             * serviced even if no socket becomes ready. */
+            if (!SSL_is_init_finished(inst->dtlsClients[i]->sslClient)) {
+                struct timeval tv;
+                if (DTLSv1_get_timeout(inst->dtlsClients[i]->sslClient, &tv)) {
+                    long long ms = (long long)tv.tv_sec * 1000 + (tv.tv_usec + 
999) / 1000;
+                    int delay = ms > INT_MAX ? INT_MAX : (int)ms;
+                    if (pollTimeout < 0 || delay < pollTimeout) {
+                        pollTimeout = delay;
+                    }
+                }
+            }
+            long long idleSeconds =
+                (long long)inst->timeout - (long long)difftime(now, 
inst->dtlsClients[i]->lastActivityTime);
+            long long idleMs = idleSeconds <= 0 ? 0 : idleSeconds * 1000;
+            int idleDelay = idleMs > INT_MAX ? INT_MAX : (int)idleMs;
+            if (pollTimeout < 0 || idleDelay < pollTimeout) {
+                pollTimeout = idleDelay;
+            }
         }
     }
 
     DBGPRINTF("imdtls: Waiting for poll (clients %d) ...\n", fdcount);
-    ret = poll(fds, fdcount + 1, -1);
+    ret = poll(fds, fdcount + 1, pollTimeout);
     if (glbl.GetGlobalInputTermState() == 1) {
         DBGPRINTF("imdtls: DTLSHandleSessions Terminate State\n");
         return; /* terminate input! */
@@ -700,14 +777,25 @@ static void DTLSHandleSessions(instanceConf_t *inst) {
     DBGPRINTF("imdtls: DTLSHandleSessions handle client sockets (%d) \n", 
fdcount);
     for (int i = 1; i <= fdcount; ++i) {
         if (clientIdxByPollSlot[i] >= 0) {
-            DTLSReadClient(inst, clientIdxByPollSlot[i], fds[i].revents);
+            int idx = clientIdxByPollSlot[i];
+            short revents = fds[i].revents | 
(inst->dtlsClients[idx]->drainPending ? POLLIN : 0);
+            DTLSReadClient(inst, idx, revents);
         }
     }
 
     // Check session timeouts
     for (int i = 0; i < MAX_DTLS_CLIENTS; ++i) {
         if (inst->dtlsClients[i]->sslClient != NULL) {
-            if (difftime(time(NULL), inst->dtlsClients[i]->lastActivityTime) > 
inst->timeout) {
+            if (!SSL_is_init_finished(inst->dtlsClients[i]->sslClient)) {
+                struct timeval tv;
+                if (DTLSv1_get_timeout(inst->dtlsClients[i]->sslClient, &tv) 
&& tv.tv_sec == 0 && tv.tv_usec == 0 &&
+                    DTLSv1_handle_timeout(inst->dtlsClients[i]->sslClient) < 
0) {
+                    DBGPRINTF("imdtls: DTLS retransmission failed for client 
index %d.\n", i);
+                    DTLScleanupSession(inst, i);
+                    continue;
+                }
+            }
+            if (difftime(time(NULL), inst->dtlsClients[i]->lastActivityTime) 
>= inst->timeout) {
                 DBGPRINTF("imdtls: Session timeout (%d) for client index 
%d.\n", i, inst->timeout);
                 DTLScleanupSession(inst, i);
                 continue;
@@ -811,12 +899,25 @@ static void DTLSHandleSessions(instanceConf_t *inst) {
                     int addedClient = 0;
                     BIO_ctrl_set_connected(rbio, client_addr);
                     DBGPRINTF("imdtls: BIO_connect succeeded.\n");
+                    /* BIO_connect can reset the socket's blocking mode. Set
+                     * O_NONBLOCK only after the BIO has been connected. */
+                    int flags = fcntl(clientfd, F_GETFL, 0);
+                    if (flags < 0 || fcntl(clientfd, F_SETFL, flags | 
O_NONBLOCK) < 0) {
+                        LogError(0, NO_ERRCODE, "imdtls: unable to make client 
socket non-blocking");
+                        close(clientfd);
+                        SSL_free(ssl);
+                        break;
+                    }
 
                     // Add to DTLS Clients
                     for (int i = 0; i < MAX_DTLS_CLIENTS; ++i) {
                         if (inst->dtlsClients[i]->sslClient == NULL) {
                             inst->dtlsClients[i]->sslClient = ssl;
                             inst->dtlsClients[i]->lastActivityTime = 
time(NULL);
+                            inst->dtlsClients[i]->peerVerified = 0;
+                            inst->dtlsClients[i]->verifiedRenegotiations = 0;
+                            inst->dtlsClients[i]->pollEvents = POLLIN;
+                            inst->dtlsClients[i]->drainPending = 0;
                             DBGPRINTF("imdtls: New Client added at idx %d.\n", 
i);
                             DTLSAcceptSession(inst, i);
                             addedClient = 1;
@@ -833,11 +934,14 @@ static void DTLSHandleSessions(instanceConf_t *inst) {
                 break;
             } else {
                 err = SSL_get_error(ssl, ret);
-                if ((ret == 0 && err == SSL_ERROR_SYSCALL) || (err == 
SSL_ERROR_SYSCALL && errno == EAGAIN)) {
-                    DBGPRINTF("imdtls: DTLSv1_listen RET %d (ERR %d / ERRNO 
%d), retry\n", ret, err, errno);
-                    // Wait little and retry DTLSv1_listen
-                    srSleep(0, 100000);
-                    continue;
+                /* Retry on EAGAIN (recv timeout, no datagram) and on ret == 0
+                 * with an empty error queue (no usable handshake data yet). */
+                if (err == SSL_ERROR_SYSCALL && (errno == EAGAIN || (ret == 0 
&& ERR_peek_error() == 0))) {
+                    DBGPRINTF("imdtls: DTLSv1_listen RET %d (ERR %d / ERRNO 
%d), defer\n", ret, err, errno);
+                    /* DTLSv1_listen is stateless across the cookie exchange.
+                     * Return to poll instead of waiting here for a second 
flight. */
+                    SSL_free(ssl);
+                    break;
                 } else {
                     DBGPRINTF("imdtls: DTLSv1_listen RET %d (ERR %d / ERRNO 
%d), abort\n", ret, err, errno);
                     net_ossl.osslLastOpenSSLErrorMsg(NULL, err, ssl, 
LOG_WARNING, "DTLSHandleSessions",
-- 
2.55.0


++++++ 0007-CVE-2026-129838-rsyslog-imuxsock-trusted-property-at.patch ++++++
>From 0701afd39a6cbdabac58623f0b41ff3928a644da Mon Sep 17 00:00:00 2001
From: Thomas BLume <[email protected]>
Date: Tue, 17 Nov 2026 08:32:20 +0100
Subject: [PATCH 7/8] CVE-2026-129838: rsyslog: imuxsock trusted-property
 attribution spoofing (bsc#1290535)

---
 plugins/imuxsock/imuxsock.c | 119 +++++++++++++++++++++++++++---------
 1 file changed, 91 insertions(+), 28 deletions(-)

diff --git a/plugins/imuxsock/imuxsock.c b/plugins/imuxsock/imuxsock.c
index aba14beb5..e21ed576a 100644
--- a/plugins/imuxsock/imuxsock.c
+++ b/plugins/imuxsock/imuxsock.c
@@ -861,29 +861,40 @@ finalize_it:
  * It is assumed the output buffer is large enough. Returns the number of
  * characters added.
  */
-static int copyescaped(uchar *dstbuf, uchar *inbuf, int inlen) {
+static size_t copyescaped(uchar *dstbuf, const uchar *inbuf, const int inlen) {
+    static const uchar hex[] = "0123456789abcdef";
     int iDst, iSrc;
 
     *dstbuf = '"';
-    for (iDst = 1, iSrc = 0; iSrc < inlen; ++iDst, ++iSrc) {
+    for (iDst = 1, iSrc = 0; iSrc < inlen; ++iSrc) {
         if (inbuf[iSrc] == '"' || inbuf[iSrc] == '\\') {
             dstbuf[iDst++] = '\\';
+            dstbuf[iDst++] = inbuf[iSrc];
+        } else if (iscntrl((unsigned char)inbuf[iSrc])) {
+            dstbuf[iDst++] = '\\';
+            dstbuf[iDst++] = 'x';
+            dstbuf[iDst++] = hex[inbuf[iSrc] >> 4];
+            dstbuf[iDst++] = hex[inbuf[iSrc] & 0x0f];
+        } else {
+            dstbuf[iDst++] = inbuf[iSrc];
         }
-        dstbuf[iDst] = inbuf[iSrc];
     }
     dstbuf[iDst++] = '"';
-    return iDst;
+    return (size_t)iDst;
 }
 
 
-static size_t escapedLen(uchar *inbuf, int inlen) {
+static size_t escapedLen(const uchar *inbuf, const int inlen) {
     size_t len = 2; /* surrounding quotes */
 
     for (int i = 0; i < inlen; ++i) {
         if (inbuf[i] == '"' || inbuf[i] == '\\') {
+            len += 2;
+        } else if (iscntrl((unsigned char)inbuf[i])) {
+            len += 4; /* \xNN */
+        } else {
             ++len;
         }
-        ++len;
     }
     return len;
 }
@@ -904,6 +915,68 @@ finalize_it:
 }
 
 
+static rsRetVal ensureTrustedPropSpace(
+    uchar **const dst, size_t *const dstLen, uchar *const stackDst, const 
size_t used, const size_t extra) {
+    uchar *newDst;
+    size_t needed;
+    size_t newLen;
+    DEFiRet;
+
+    if (extra > (size_t)-1 - used) {
+        ABORT_FINALIZE(RS_RET_ERR);
+    }
+    needed = used + extra;
+    if (needed <= *dstLen) {
+        FINALIZE;
+    }
+
+    newLen = *dstLen;
+    while (newLen < needed) {
+        if (newLen > (size_t)-1 / 2) {
+            newLen = needed;
+        } else {
+            newLen *= 2;
+        }
+    }
+
+    if (*dst == stackDst) {
+        CHKmalloc(newDst = malloc(newLen));
+        memcpy(newDst, *dst, used);
+    } else {
+        CHKmalloc(newDst = realloc(*dst, newLen));
+    }
+    *dst = newDst;
+    *dstLen = newLen;
+
+finalize_it:
+    RETiRet;
+}
+
+
+static rsRetVal appendEscapedTrustedProp(uchar **const dst,
+                                         size_t *const dstLen,
+                                         uchar *const stackDst,
+                                         size_t *const offs,
+                                         const uchar *const name,
+                                         const size_t nameLen,
+                                         const uchar *const value,
+                                         const int valueLen) {
+    size_t escaped;
+    DEFiRet;
+
+    escaped = escapedLen(value, valueLen);
+    if (nameLen > (size_t)-1 - escaped || nameLen + escaped > (size_t)-1 - 2) {
+        ABORT_FINALIZE(RS_RET_ERR);
+    }
+    CHKiRet(ensureTrustedPropSpace(dst, dstLen, stackDst, *offs, nameLen + 
escaped + 2));
+    CHKiRet(appendTrustedProp(*dst, *dstLen, offs, name, nameLen));
+    *offs += copyescaped(*dst + *offs, value, valueLen);
+
+finalize_it:
+    RETiRet;
+}
+
+
 /* submit received message to the queue engine
  * We now parse the message according to expected format so that we
  * can also mangle it if necessary.
@@ -1016,22 +1089,17 @@ static rsRetVal SubmitMsg(uchar *pRcv, int lenRcv, 
lstn_t *pLstn, struct ucred *
         } else {
             uchar msgbuf[8192];
             uchar *pmsgbuf = msgbuf;
-            const size_t trustedPropBufLen = sizeof(propBuf) - 1;
-            const size_t trustedPropMaxExtra = 3 + /* " @[" */
-                                               96 + /* _PID/_UID/_GID tags 
plus maximum decimal values */
-                                               7 + trustedPropBufLen + /* 
_COMM= */
-                                               6 + trustedPropBufLen + /* 
_EXE= */
-                                               10 + 2 + 2 * trustedPropBufLen 
+ /* _CMDLINE= plus escaped value */
-                                               2; /* closing bracket and NUL */
+            const size_t trustedPropFixedExtra = 3 + /* " @[" */
+                                                 96 + /* _PID/_UID/_GID tags 
plus maximum decimal values */
+                                                 2; /* closing bracket and NUL 
*/
             size_t msgbuf_size = sizeof(msgbuf);
             size_t toffs; /* offset for trusted properties */
-            size_t escaped;
 
-            if ((size_t)lenRcv > (size_t)-1 - trustedPropMaxExtra) {
+            if ((size_t)lenRcv > (size_t)-1 - trustedPropFixedExtra) {
                 ABORT_FINALIZE(RS_RET_ERR);
             }
-            if ((size_t)lenRcv + trustedPropMaxExtra > sizeof(msgbuf)) {
-                msgbuf_size = (size_t)lenRcv + trustedPropMaxExtra;
+            if ((size_t)lenRcv + trustedPropFixedExtra > sizeof(msgbuf)) {
+                msgbuf_size = (size_t)lenRcv + trustedPropFixedExtra;
                 CHKmalloc(pmsgbuf = malloc(msgbuf_size));
             }
 
@@ -1051,30 +1119,25 @@ static rsRetVal SubmitMsg(uchar *pRcv, int lenRcv, 
lstn_t *pLstn, struct ucred *
             }
 
             if (getTrustedProp(cred, "comm", propBuf, sizeof(propBuf), 
&lenProp) == RS_RET_OK) {
-                if ((iRet = appendTrustedProp(pmsgbuf, msgbuf_size, &toffs, 
(uchar *)" _COMM=", 7)) != RS_RET_OK ||
-                    (iRet = appendTrustedProp(pmsgbuf, msgbuf_size, &toffs, 
propBuf, (size_t)lenProp)) != RS_RET_OK) {
+                if ((iRet = appendEscapedTrustedProp(&pmsgbuf, &msgbuf_size, 
msgbuf, &toffs, (uchar *)" _COMM=", 7,
+                                                     propBuf, lenProp)) != 
RS_RET_OK) {
                     if (pmsgbuf != msgbuf) free(pmsgbuf);
                     FINALIZE;
                 }
             }
             if (getTrustedExe(cred, propBuf, sizeof(propBuf), &lenProp) == 
RS_RET_OK) {
-                if ((iRet = appendTrustedProp(pmsgbuf, msgbuf_size, &toffs, 
(uchar *)" _EXE=", 6)) != RS_RET_OK ||
-                    (iRet = appendTrustedProp(pmsgbuf, msgbuf_size, &toffs, 
propBuf, (size_t)lenProp)) != RS_RET_OK) {
+                if ((iRet = appendEscapedTrustedProp(&pmsgbuf, &msgbuf_size, 
msgbuf, &toffs, (uchar *)" _EXE=", 6,
+                                                     propBuf, lenProp)) != 
RS_RET_OK) {
                     if (pmsgbuf != msgbuf) free(pmsgbuf);
                     FINALIZE;
                 }
             }
             if (getTrustedProp(cred, "cmdline", propBuf, sizeof(propBuf), 
&lenProp) == RS_RET_OK) {
-                if ((iRet = appendTrustedProp(pmsgbuf, msgbuf_size, &toffs, 
(uchar *)" _CMDLINE=", 10)) != RS_RET_OK) {
+                if ((iRet = appendEscapedTrustedProp(&pmsgbuf, &msgbuf_size, 
msgbuf, &toffs, (uchar *)" _CMDLINE=", 10,
+                                                     propBuf, lenProp)) != 
RS_RET_OK) {
                     if (pmsgbuf != msgbuf) free(pmsgbuf);
                     FINALIZE;
                 }
-                escaped = escapedLen(propBuf, lenProp);
-                if (escaped > msgbuf_size || toffs > msgbuf_size - escaped) {
-                    if (pmsgbuf != msgbuf) free(pmsgbuf);
-                    ABORT_FINALIZE(RS_RET_ERR);
-                }
-                toffs += (size_t)copyescaped(pmsgbuf + toffs, propBuf, 
lenProp);
             }
 
             /* finalize string */
-- 
2.55.0


++++++ 0008-CVE-2026-129839-rsyslog-template-JSON-escaping-defec.patch ++++++
>From b071b96d9f4e9b224d6abc017748cb04f15d955d Mon Sep 17 00:00:00 2001
From: Thomas BLume <[email protected]>
Date: Tue, 17 Nov 2026 08:33:36 +0100
Subject: [PATCH 8/8] CVE-2026-129839: rsyslog: template JSON escaping defect
 (bsc#1290536)

---
 runtime/template.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/runtime/template.c b/runtime/template.c
index 246f52e2e..b93da8d86 100644
--- a/runtime/template.c
+++ b/runtime/template.c
@@ -1159,7 +1159,7 @@ rsRetVal doEscape(uchar **pp, rs_size_t *pLen, unsigned 
short *pbMustBeFreed, in
     else if (mode == SQL_ESCAPE)
         for (p = *pp; *p && *p != '\'' && *p != '\\'; ++p);
     else if (mode == JSON_ESCAPE)
-        for (p = *pp; *p && (*p == '"' || *p == '\\'); ++p);
+        for (p = *pp; *p && *p != '"' && *p != '\\'; ++p);
     /* when we get out of the loop, we are either at the
      * string terminator or the first character to escape */
     if (p && *p == '\0') FINALIZE; /* nothing to do in this case! */
-- 
2.55.0


++++++ 0009-CVE-2026-129837-rsyslog-weekday-formatting-crash-bsc.patch ++++++
>From b8d092997091c84d49fe94268575feefa64bd3ac Mon Sep 17 00:00:00 2001
From: Thomas BLume <[email protected]>
Date: Tue, 17 Nov 2026 10:27:10 +0100
Subject: [PATCH 9/9] CVE-2026-129837: rsyslog: weekday formatting crash
 (bsc#1290534)

---
 runtime/datetime.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/runtime/datetime.c b/runtime/datetime.c
index 67392aa96..9faaaf192 100644
--- a/runtime/datetime.c
+++ b/runtime/datetime.c
@@ -1187,6 +1187,7 @@ int getWeekdayNbr(struct syslogTime *ts) {
     }
     wday = ((36525 * g) / 100) + ((306 * f) / 10) + ts->day - 621049;
     wday %= 7;
+    if (wday < 0) wday += 7;
     return wday;
 }
 
@@ -1391,4 +1392,4 @@ BEGINAbstractObjClassInit(datetime, 1, 
OBJ_IS_CORE_MODULE) /* class, version */
 ENDObjClassInit(datetime)
 
 /* vi:set ai:
- */
\ No newline at end of file
+ */
-- 
2.55.0

Reply via email to