From 97bda43e372a506671cb7007b6041e4160a02b04 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Thu, 10 Oct 2013 14:44:17 +0200 Subject: bugfix: mmutf8fix did not properly handle invalid UTF-8 at END of message if the very last character sequence was too long, this was not detected Thanks to Risto Vaarandi for reporting this problem. --- ChangeLog | 3 +++ plugins/mmutf8fix/mmutf8fix.c | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/ChangeLog b/ChangeLog index 03883f43..c0d8ed2a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,9 @@ Version 7.5.5 [devel] 2013-10-?? - imudp: add "dfltTZ" input config parameter - bugfix: memory leak in mmnormalize +- bugfix: mmutf8fix did not properly handle invalid UTF-8 at END of message + if the very last character sequence was too long, this was not detected + Thanks to Risto Vaarandi for reporting this problem. --------------------------------------------------------------------------- Version 7.5.4 [devel] 2013-10-07 - mmpstrucdata: new module to parse RFC5424 structured data into json diff --git a/plugins/mmutf8fix/mmutf8fix.c b/plugins/mmutf8fix/mmutf8fix.c index 41d98653..f49e79fa 100644 --- a/plugins/mmutf8fix/mmutf8fix.c +++ b/plugins/mmutf8fix/mmutf8fix.c @@ -256,6 +256,11 @@ doUTF8(instanceData *pData, uchar *msg, int lenMsg) } else { /* invalid (5&6 byte forbidden by RFC3629) */ msg[i] = pData->replChar; } + if(i+bytesleft >= lenMsg) { + /* invalid, as rest of message cannot contain full char */ + fixInvldMBSeq(pData, msg, lenMsg, strtIdx, lenMsg, seqLen); + i = lenMsg - 1; + } } } } -- cgit v1.2.3