From 9f6cd3b70961f481157f6c59bb32605cb0e47125 Mon Sep 17 00:00:00 2001 From: azaozz Date: Tue, 14 Jul 2009 08:20:24 +0000 Subject: [PATCH] Truncate comment agent when longer than 255 chars, props Denis-de-Bernardy, fixes #10389 git-svn-id: http://svn.automattic.com/wordpress/trunk@11713 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/comment.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wp-includes/comment.php b/wp-includes/comment.php index 53e2233dc..b4f4125cc 100644 --- a/wp-includes/comment.php +++ b/wp-includes/comment.php @@ -983,7 +983,7 @@ function wp_new_comment( $commentdata ) { $commentdata['comment_parent'] = ( 'approved' == $parent_status || 'unapproved' == $parent_status ) ? $commentdata['comment_parent'] : 0; $commentdata['comment_author_IP'] = preg_replace( '/[^0-9a-fA-F:., ]/', '',$_SERVER['REMOTE_ADDR'] ); - $commentdata['comment_agent'] = $_SERVER['HTTP_USER_AGENT']; + $commentdata['comment_agent'] = substr($_SERVER['HTTP_USER_AGENT'], 0, 254); $commentdata['comment_date'] = current_time('mysql'); $commentdata['comment_date_gmt'] = current_time('mysql', 1);