Closed
Bug 149845
Opened 23 years ago
Closed 23 years ago
buglist.cgi checks for ORDER validity are wrong
Categories
(Bugzilla :: Query/Bug List, defect)
Tracking
()
RESOLVED
FIXED
Bugzilla 2.16
People
(Reporter: bbaetz, Assigned: bbaetz)
References
()
Details
Attachments
(1 file)
|
1.36 KB,
patch
|
myk
:
review+
myk
:
review+
|
Details | Diff | Splinter Review |
buglist.cgi has:
foreach my $fragment (split(/[,\s]+/, $order)) {
next if $fragment =~ /^asc|desc$/i;
This is wrong, because /^asc|desc$/i is /(^asc)|(desc$)/, not /^(asc|desc)$/, as
it should be. This should be fixed for 2.16, as even though I don't think its
exploitable, its letting something through we didn't want to.
The split regexp allows ,, though, which is also wrong.
We should do what I suggested mattyt do for 2.14.2 patch does, and split on /,/.
The grep should then be changed to check for trim($_) =~ /$fragment(\s+asc|desc))?/
The grep will go thorugh all the coumns, too, while we only want want to check
for any single match - is there a better way to do this?
| Assignee | ||
Comment 1•23 years ago
|
||
OK, try this. The regexp I wrote in my earlier comment was obviously wrong,
though - the one on the patch actually works.
I also moved the @columnnames generation out of the foreach - I don't see why
it has to be regenerated each time.
| Assignee | ||
Updated•23 years ago
|
Comment 2•23 years ago
|
||
Comment on attachment 86770 [details] [diff] [review]
v1
+ $fragment = trim($fragment);
Nit: This can be rolled into the regular expression with \s* at the beginning
and end.
r=myk
Attachment #86770 -
Flags: review+
Comment 3•23 years ago
|
||
Comment on attachment 86770 [details] [diff] [review]
v1
Oops, I meant to give this 2xr=myk but got distracted. Here it is now.
Attachment #86770 -
Flags: review+
Comment 4•23 years ago
|
||
Personally I think that trim is better style. We should we wary of turning the
whole world into a regexp, even if we can, as they tend to be harder to read.
| Assignee | ||
Comment 5•23 years ago
|
||
Checked in, trunk + branch:
Checking in buglist.cgi;
/cvsroot/mozilla/webtools/bugzilla/buglist.cgi,v <-- buglist.cgi
new revision: 1.169.2.6; previous revision: 1.169.2.5
done
Checking in buglist.cgi;
/cvsroot/mozilla/webtools/bugzilla/buglist.cgi,v <-- buglist.cgi
new revision: 1.174; previous revision: 1.173
done
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
Updated•13 years ago
|
QA Contact: matty_is_a_geek → default-qa
You need to log in
before you can comment on or make changes to this bug.
Description
•