]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-content/plugins/akismet/class.akismet.php
WordPress 4.4
[autoinstalls/wordpress.git] / wp-content / plugins / akismet / class.akismet.php
index 7a637386d0674ded435c889389a8fbb12a7480f5..ede1d1b96df21104f2d697cfab98793e7131bbcc 100644 (file)
@@ -708,14 +708,19 @@ class Akismet {
                           isset( $comment1['comment_post_ID'], $comment2['comment_post_ID'] )
                        && intval( $comment1['comment_post_ID'] ) == intval( $comment2['comment_post_ID'] )
                        && (
                           isset( $comment1['comment_post_ID'], $comment2['comment_post_ID'] )
                        && intval( $comment1['comment_post_ID'] ) == intval( $comment2['comment_post_ID'] )
                        && (
-                               $comment1['comment_author'] == $comment2['comment_author']
-                               || stripslashes( $comment1['comment_author'] ) == $comment2['comment_author']
-                               || $comment1['comment_author'] == stripslashes( $comment2['comment_author'] )
+                               // The comment author length max is 255 characters, limited by the TINYTEXT column type.
+                               substr( $comment1['comment_author'], 0, 255 ) == substr( $comment2['comment_author'], 0, 255 )
+                               || substr( stripslashes( $comment1['comment_author'] ), 0, 255 ) == substr( $comment2['comment_author'], 0, 255 )
+                               || substr( $comment1['comment_author'], 0, 255 ) == substr( stripslashes( $comment2['comment_author'] ), 0, 255 )
                                )
                        && (
                                )
                        && (
-                               $comment1['comment_author_email'] == $comment2['comment_author_email']
-                               || stripslashes( $comment1['comment_author_email'] ) == $comment2['comment_author_email']
-                               || $comment1['comment_author_email'] == stripslashes( $comment2['comment_author_email'] )
+                               // The email max length is 100 characters, limited by the VARCHAR(100) column type.
+                               substr( $comment1['comment_author_email'], 0, 100 ) == substr( $comment2['comment_author_email'], 0, 100 )
+                               || substr( stripslashes( $comment1['comment_author_email'] ), 0, 100 ) == substr( $comment2['comment_author_email'], 0, 100 )
+                               || substr( $comment1['comment_author_email'], 0, 100 ) == substr( stripslashes( $comment2['comment_author_email'] ), 0, 100 )
+                               // Very long emails can be truncated and then stripped if the [0:100] substring isn't a valid address.
+                               || ( ! $comment1['comment_author_email'] && strlen( $comment2['comment_author_email'] ) > 100 )
+                               || ( ! $comment2['comment_author_email'] && strlen( $comment1['comment_author_email'] ) > 100 )
                        )
                );
        }
                        )
                );
        }