From b4d3313c3d26f04ab46e78c678842f61afb11659 Mon Sep 17 00:00:00 2001 From: "myk%mozilla.org" Date: Mon, 11 Mar 2002 07:33:03 +0000 Subject: [PATCH] Fix for bug 72184: prevents users from entering too-large comments/descriptions that get rejected by MySQL's MAX_PACKET_SIZE restrictions. Patch by Myk Melez . r=bbaetz,gerv git-svn-id: svn://10.0.0.236/trunk@116320 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/webtools/bugzilla/CGI.pl | 13 +++++++++++++ mozilla/webtools/bugzilla/attachment.cgi | 2 ++ mozilla/webtools/bugzilla/post_bug.cgi | 2 ++ mozilla/webtools/bugzilla/process_bug.cgi | 2 ++ 4 files changed, 19 insertions(+) diff --git a/mozilla/webtools/bugzilla/CGI.pl b/mozilla/webtools/bugzilla/CGI.pl index f91cbd67044..0882a967cc3 100644 --- a/mozilla/webtools/bugzilla/CGI.pl +++ b/mozilla/webtools/bugzilla/CGI.pl @@ -324,6 +324,19 @@ sub ValidateBugID { } + +sub ValidateComment { + # Make sure a comment is not too large (greater than 64K). + + my ($comment) = @_; + + if (defined($comment) && length($comment) > 65535) { + DisplayError("Comments cannot be longer than 65,535 characters."); + exit; + } +} + + # check and see if a given string actually represents a positive # integer, and abort if not. # diff --git a/mozilla/webtools/bugzilla/attachment.cgi b/mozilla/webtools/bugzilla/attachment.cgi index 32b4ef46157..66c3236a70d 100755 --- a/mozilla/webtools/bugzilla/attachment.cgi +++ b/mozilla/webtools/bugzilla/attachment.cgi @@ -77,6 +77,7 @@ elsif ($action eq "insert") { confirm_login(); ValidateBugID($::FORM{'bugid'}); + ValidateComment($::FORM{'comment'}); validateFilename(); validateData(); validateDescription(); @@ -95,6 +96,7 @@ elsif ($action eq "edit") elsif ($action eq "update") { confirm_login(); + ValidateComment($::FORM{'comment'}); validateID(); validateCanEdit($::FORM{'id'}); validateDescription(); diff --git a/mozilla/webtools/bugzilla/post_bug.cgi b/mozilla/webtools/bugzilla/post_bug.cgi index 0ae44d32fca..58048ef7ea7 100755 --- a/mozilla/webtools/bugzilla/post_bug.cgi +++ b/mozilla/webtools/bugzilla/post_bug.cgi @@ -49,6 +49,8 @@ sub sillyness { confirm_login(); +ValidateComment($::FORM{'comment'}); + my $cookiepath = Param("cookiepath"); print "Set-Cookie: PLATFORM=$::FORM{'product'} ; path=$cookiepath ; expires=Sun, 30-Jun-2029 00:00:00 GMT\n" if ( exists $::FORM{'product'} ); print "Set-Cookie: VERSION-$::FORM{'product'}=$::FORM{'version'} ; path=$cookiepath ; expires=Sun, 30-Jun-2029 00:00:00 GMT\n" if ( exists $::FORM{'product'} && exists $::FORM{'version'} ); diff --git a/mozilla/webtools/bugzilla/process_bug.cgi b/mozilla/webtools/bugzilla/process_bug.cgi index f2abb039048..fb3c0e48258 100755 --- a/mozilla/webtools/bugzilla/process_bug.cgi +++ b/mozilla/webtools/bugzilla/process_bug.cgi @@ -92,6 +92,8 @@ if (defined $::FORM{'dup_id'} && $::FORM{'knob'} eq "duplicate") { DuplicateUserConfirm(); } +ValidateComment($::FORM{'comment'}); + ###################################################################### # End Data/Security Validation ######################################################################