From 356ca50b2244ab30137f27ab978cde5e952d9dd3 Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Thu, 14 Aug 2014 12:27:34 -0500
Subject: [PATCH] oops: Fix gross error truncating thread messages

---
 include/class.thread.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/class.thread.php b/include/class.thread.php
index 3b773bfda..2fa25f530 100644
--- a/include/class.thread.php
+++ b/include/class.thread.php
@@ -1284,7 +1284,7 @@ class ThreadBody /* extends SplString */ {
         if (strlen($this->body) > 250000) {
             $max_packet = db_get_variable('max_allowed_packet', 'global');
             // Truncate just short of the max_allowed_packet
-            $this->body = substr($this->body, $max_packet - 2048) . ' ... (truncated)';
+            $this->body = substr($this->body, 0, $max_packet - 2048) . ' ... (truncated)';
         }
         $this->type = $type;
         $this->options = array_merge($this->options, $options);
-- 
GitLab