diff --git a/Sources/Plasma/PubUtilLib/plStatusLog/plStatusLog.cpp b/Sources/Plasma/PubUtilLib/plStatusLog/plStatusLog.cpp index 5df6ad41..99ea3b44 100644 --- a/Sources/Plasma/PubUtilLib/plStatusLog/plStatusLog.cpp +++ b/Sources/Plasma/PubUtilLib/plStatusLog/plStatusLog.cpp @@ -830,10 +830,12 @@ bool plStatusLog::IPrintLineToFile( const char *line, UInt32 count ) strncat(buf, work, arrsize(work)); } - if (count < arrsize(buf) - strlen(buf)) { + size_t remaining = arrsize(buf) - strlen(buf) - 1; + if (!fEncryptMe) remaining -= 1; + if (count <= remaining) { strncat(buf, line, count); } else { - strncat(buf, line, arrsize(buf) - strlen(buf)); + strncat(buf, line, remaining); } if(!fEncryptMe )