summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog2
-rw-r--r--runtime/parser.c6
2 files changed, 6 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 6272aee2..abec5762 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
---------------------------------------------------------------------------
Version 4.4.2 [v4-stable] (rgerhards), 2009-09-??
+- bugfix: invalid handling of zero-sized messages, could lead to mis-
+ addressing and potential memory corruption/segfault
- bugfix: random data could be appended to message, possibly causing
segfaults
- bugfix: reverse lookup reduction logic in imudp do DNS queries too often
diff --git a/runtime/parser.c b/runtime/parser.c
index 079bcf5e..7eff0801 100644
--- a/runtime/parser.c
+++ b/runtime/parser.c
@@ -167,6 +167,7 @@ sanitizeMessage(msg_t *pMsg)
size_t iMaxLine;
assert(pMsg != NULL);
+ assert(pMsg->iLenRawMsg > 0);
# ifdef USE_NETZIP
CHKiRet(uncompressMessage(pMsg));
@@ -288,6 +289,9 @@ rsRetVal parseMsg(msg_t *pMsg)
int lenMsg;
int iPriText;
+ if(pMsg->iLenRawMsg == 0)
+ ABORT_FINALIZE(RS_RET_EMPTY_MSG);
+
CHKiRet(sanitizeMessage(pMsg));
/* we needed to sanitize first, because we otherwise do not have a C-string we can print... */
@@ -295,8 +299,6 @@ rsRetVal parseMsg(msg_t *pMsg)
/* pull PRI */
lenMsg = pMsg->iLenRawMsg;
- if(lenMsg == 0)
- ABORT_FINALIZE(RS_RET_EMPTY_MSG);
msg = pMsg->pszRawMsg;
pri = DEFUPRI;
iPriText = 0;