Bugzilla – Attachment 11687 Details for
Bug 7678
Statistics wizard: patrons
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 7678: follow-up to pass QA
0002-Bug-7678-follow-up-to-pass-QA.patch (text/plain), 2.04 KB, created by
Julian Maurice
on 2012-08-20 07:04:15 UTC
(
hide
)
Description:
Bug 7678: follow-up to pass QA
Filename:
MIME Type:
Creator:
Julian Maurice
Created:
2012-08-20 07:04:15 UTC
Size:
2.04 KB
patch
obsolete
>From cdf8ab10df460a9c0713318f8b7f90072f956bad Mon Sep 17 00:00:00 2001 >From: Julian Maurice <julian.maurice@biblibre.com> >Date: Mon, 20 Aug 2012 08:57:42 +0200 >Subject: [PATCH 2/2] Bug 7678: follow-up to pass QA > >Check input parameters to avoid SQL injection >Rewrite a for loop for readability >--- > reports/borrowers_stats.pl | 21 ++++++++++++++------- > 1 file changed, 14 insertions(+), 7 deletions(-) > >diff --git a/reports/borrowers_stats.pl b/reports/borrowers_stats.pl >index cefe10f..c6e7c93 100755 >--- a/reports/borrowers_stats.pl >+++ b/reports/borrowers_stats.pl >@@ -181,6 +181,13 @@ sub calculate { > # extract parameters > my $dbh = C4::Context->dbh; > >+ my @valid_names = qw(categorycode zipcode branchcode sex sort1 sort2); >+ return unless (grep /^$line$/, @valid_names); >+ return unless (grep /^$column$/, @valid_names); >+ return if ($digits and $digits !~ /^\d+$/); >+ return if ($status and (grep /^$status$/, qw(debarred gonenoaddress lost)) == 0); >+ return if ($activity and (grep /^$activity$/, qw(active nonactive)) == 0); >+ > # Filters > my $linefilter; > given ($line) { >@@ -207,7 +214,7 @@ sub calculate { > } > > my @loopfilter; >- for (my $i = 0; $i <= scalar @$filters; $i++) { >+ foreach my $i (0 .. scalar @$filters) { > my %cell; > if ( @$filters[$i] ) { > if ($i == 3 or $i == 4) { >@@ -249,7 +256,7 @@ sub calculate { > my $linefield; > > my $line_attribute_type; >- if ($line =~/^patron_attr.(.*)$/) { >+ if ($line =~/^patron_attr\.(.*)$/) { > $line_attribute_type = $1; > $line = 'borrower_attributes.attribute'; > } >@@ -305,11 +312,11 @@ sub calculate { > $column = 'borrower_attributes.attribute'; > } > >- if (($column =~/zipcode/) and ($digits)) { >- $colfield = "left($column,$digits)"; >- } else { >- $colfield = $column; >- } >+ if (($column =~/zipcode/) and ($digits)) { >+ $colfield = "left($column,$digits)"; >+ } else { >+ $colfield = $column; >+ } > > my $strsth2; > my @strparams2; # bind parameters for the query >-- >1.7.10.4 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 7678
:
11445
|
11597
|
11687
|
12742
|
12753
|
12941
|
12942
|
13829
|
13830
|
13975
|
14710
|
14728