summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2005-07-08 04:33:25 +0200
committerlpsolit%gmail.com <>2005-07-08 04:33:25 +0200
commitc442d60daba16cee6584322c58a0c4b76a154958 (patch)
tree1c5ffa41ae7b3adbf3fbd29be359364fbd950e74
parent3886fbfb3229e3918de3f661d1e6c19f7be520f0 (diff)
downloadbugzilla-c442d60daba16cee6584322c58a0c4b76a154958.tar.gz
bugzilla-c442d60daba16cee6584322c58a0c4b76a154958.tar.xz
Bug 298508 + bug 298510: Many uninitialized value errors in editwhines involving length function + Numeric comparison performed on strings - Both patches by A. Karl Kornel <karl@kornel.name> r=LpSolit a=justdave
-rwxr-xr-xeditwhines.cgi74
1 files changed, 24 insertions, 50 deletions
diff --git a/editwhines.cgi b/editwhines.cgi
index 33a7fc499..1f5c954f3 100755
--- a/editwhines.cgi
+++ b/editwhines.cgi
@@ -221,23 +221,14 @@ if ($cgi->param('update')) {
}
}
else {
- my $o_day = $cgi->param("orig_day_$sid");
- my $day = $cgi->param("day_$sid");
- my $o_time = $cgi->param("orig_time_$sid");
- my $time = $cgi->param("time_$sid");
- my $o_mailto = $cgi->param("orig_mailto_$sid");
- my $mailto = $cgi->param("mailto_$sid");
- my $o_mailto_type = lc $cgi->param("orig_mailto_type_$sid");
- my $mailto_type = $cgi->param("mailto_type_$sid");
-
- $o_day = '' unless length($o_day);
- $o_time = '' unless length($o_time);
- $o_mailto = '' unless length($o_mailto);
- $o_mailto_type = '' unless length($o_mailto_type);
- $day = '' unless length($day);
- $time = '' unless length($time);
- $mailto = '' unless length($mailto);
- $mailto_type = '' unless length($mailto_type);
+ my $o_day = $cgi->param("orig_day_$sid") || '';
+ my $day = $cgi->param("day_$sid") || '';
+ my $o_time = $cgi->param("orig_time_$sid") || '';
+ my $time = $cgi->param("time_$sid") || '';
+ my $o_mailto = $cgi->param("orig_mailto_$sid") || '';
+ my $mailto = $cgi->param("mailto_$sid") || '';
+ my $o_mailto_type = $cgi->param("orig_mailto_type_$sid") || 0;
+ my $mailto_type = $cgi->param("mailto_type_$sid") || 0;
my $mailto_id = $userid;
@@ -271,11 +262,11 @@ if ($cgi->param('update')) {
if ( ($o_day ne $day) ||
($o_time ne $time) ||
- ($o_mailto != $mailto) ||
+ ($o_mailto ne $mailto) ||
($o_mailto_type != $mailto_type) ){
- trick_taint($day) if length($day);
- trick_taint($time) if length($time);
+ trick_taint($day);
+ trick_taint($time);
# the schedule table must be locked
$sth = $dbh->prepare("UPDATE whine_schedules " .
@@ -318,42 +309,25 @@ if ($cgi->param('update')) {
}
}
else {
- my $o_sort = $cgi->param("orig_query_sort_$qid");
- my $sort = $cgi->param("query_sort_$qid");
- my $o_queryname = $cgi->param("orig_query_name_$qid");
- my $queryname = $cgi->param("query_name_$qid");
- my $o_title = $cgi->param("orig_query_title_$qid");
- my $title = $cgi->param("query_title_$qid");
+ my $o_sort = $cgi->param("orig_query_sort_$qid") || 0;
+ my $sort = $cgi->param("query_sort_$qid") || 0;
+ my $o_queryname = $cgi->param("orig_query_name_$qid") || '';
+ my $queryname = $cgi->param("query_name_$qid") || '';
+ my $o_title = $cgi->param("orig_query_title_$qid") || '';
+ my $title = $cgi->param("query_title_$qid") || '';
my $o_onemailperbug =
- $cgi->param("orig_query_onemailperbug_$qid");
+ $cgi->param("orig_query_onemailperbug_$qid") || 0;
my $onemailperbug =
- $cgi->param("query_onemailperbug_$qid");
-
- $o_sort = '' unless length($o_sort);
- $o_queryname = '' unless length($o_queryname);
- $o_title = '' unless length($o_title);
- $o_onemailperbug = '' unless length($o_onemailperbug);
- $sort = '' unless length($sort);
- $queryname = '' unless length($queryname);
- $title = '' unless length($title);
- $onemailperbug = '' unless length($onemailperbug);
-
- if ($onemailperbug eq 'on') {
- $onemailperbug = 1;
- }
- elsif ($onemailperbug eq 'off') {
- $onemailperbug = 0;
- }
+ $cgi->param("query_onemailperbug_$qid") ? 1 : 0;
- if ( ($o_sort ne $sort) ||
+ if ( ($o_sort != $sort) ||
($o_queryname ne $queryname) ||
- ($o_onemailperbug xor $onemailperbug) ||
+ ($o_onemailperbug != $onemailperbug) ||
($o_title ne $title) ){
- detaint_natural($sort) if length $sort;
- trick_taint($queryname) if length $queryname;
- trick_taint($title) if length $title;
- trick_taint($onemailperbug) if length $onemailperbug;
+ detaint_natural($sort);
+ trick_taint($queryname);
+ trick_taint($title);
$sth = $dbh->prepare("UPDATE whine_queries " .
"SET sortkey=?, " .