Browse Source

Limit PM max length

We encrypt PMs, so if the encrypted text is truncated by mysql, the
entire message is destroyed. Truncate it before encryption so that
doesn't happen
spaghetti 8 years ago
parent
commit
50605ee4ec
2 changed files with 2 additions and 2 deletions
  1. 1
    1
      classes/misc.class.php
  2. 1
    1
      sections/inbox/compose.php

+ 1
- 1
classes/misc.class.php View File

@@ -50,7 +50,7 @@ class Misc {
50 50
     $UnescapedSubject = $Subject;
51 51
     $UnescapedBody = $Body;
52 52
     $Subject = db_string($Subject);
53
-    $Body = DBCrypt::encrypt($Body);
53
+    $Body = DBCrypt::encrypt(substr($Body, 0, 49135)); // 49135 -> encryption -> 65536 (max length in mysql)
54 54
     if ($ToID == 0) {
55 55
       // Don't allow users to send messages to the system
56 56
       return;

+ 1
- 1
sections/inbox/compose.php View File

@@ -41,7 +41,7 @@ View::show_header('Compose', 'inbox,bbcode,jquery.validate,form_validate');
41 41
         <h3>Subject</h3>
42 42
         <input type="text" class="required" name="subject" size="95" value="<?=(!empty($Subject) ? $Subject : '')?>" /><br />
43 43
         <h3>Body</h3>
44
-        <textarea id="body" class="required" name="body" cols="95" rows="10" onkeyup="resize('body')"><?=(!empty($Body) ? $Body : '')?></textarea>
44
+        <textarea id="body" class="required" name="body" cols="95" rows="10" maxlength="49000" onkeyup="resize('body')"><?=(!empty($Body) ? $Body : '')?></textarea>
45 45
       </div>
46 46
       <div id="preview" class="hidden"></div>
47 47
       <div id="buttons" class="center">

Loading…
Cancel
Save