Commit c442d60d authored by lpsolit%gmail.com's avatar lpsolit%gmail.com

Bug 298508 + bug 298510: Many uninitialized value errors in editwhines involving…

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
parent 3886fbfb
...@@ -221,23 +221,14 @@ if ($cgi->param('update')) { ...@@ -221,23 +221,14 @@ if ($cgi->param('update')) {
} }
} }
else { else {
my $o_day = $cgi->param("orig_day_$sid"); my $o_day = $cgi->param("orig_day_$sid") || '';
my $day = $cgi->param("day_$sid"); my $day = $cgi->param("day_$sid") || '';
my $o_time = $cgi->param("orig_time_$sid"); my $o_time = $cgi->param("orig_time_$sid") || '';
my $time = $cgi->param("time_$sid"); my $time = $cgi->param("time_$sid") || '';
my $o_mailto = $cgi->param("orig_mailto_$sid"); my $o_mailto = $cgi->param("orig_mailto_$sid") || '';
my $mailto = $cgi->param("mailto_$sid"); my $mailto = $cgi->param("mailto_$sid") || '';
my $o_mailto_type = lc $cgi->param("orig_mailto_type_$sid"); my $o_mailto_type = $cgi->param("orig_mailto_type_$sid") || 0;
my $mailto_type = $cgi->param("mailto_type_$sid"); my $mailto_type = $cgi->param("mailto_type_$sid") || 0;
$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 $mailto_id = $userid; my $mailto_id = $userid;
...@@ -271,11 +262,11 @@ if ($cgi->param('update')) { ...@@ -271,11 +262,11 @@ if ($cgi->param('update')) {
if ( ($o_day ne $day) || if ( ($o_day ne $day) ||
($o_time ne $time) || ($o_time ne $time) ||
($o_mailto != $mailto) || ($o_mailto ne $mailto) ||
($o_mailto_type != $mailto_type) ){ ($o_mailto_type != $mailto_type) ){
trick_taint($day) if length($day); trick_taint($day);
trick_taint($time) if length($time); trick_taint($time);
# the schedule table must be locked # the schedule table must be locked
$sth = $dbh->prepare("UPDATE whine_schedules " . $sth = $dbh->prepare("UPDATE whine_schedules " .
...@@ -318,42 +309,25 @@ if ($cgi->param('update')) { ...@@ -318,42 +309,25 @@ if ($cgi->param('update')) {
} }
} }
else { else {
my $o_sort = $cgi->param("orig_query_sort_$qid"); my $o_sort = $cgi->param("orig_query_sort_$qid") || 0;
my $sort = $cgi->param("query_sort_$qid"); my $sort = $cgi->param("query_sort_$qid") || 0;
my $o_queryname = $cgi->param("orig_query_name_$qid"); my $o_queryname = $cgi->param("orig_query_name_$qid") || '';
my $queryname = $cgi->param("query_name_$qid"); my $queryname = $cgi->param("query_name_$qid") || '';
my $o_title = $cgi->param("orig_query_title_$qid"); my $o_title = $cgi->param("orig_query_title_$qid") || '';
my $title = $cgi->param("query_title_$qid"); my $title = $cgi->param("query_title_$qid") || '';
my $o_onemailperbug = my $o_onemailperbug =
$cgi->param("orig_query_onemailperbug_$qid"); $cgi->param("orig_query_onemailperbug_$qid") || 0;
my $onemailperbug = my $onemailperbug =
$cgi->param("query_onemailperbug_$qid"); $cgi->param("query_onemailperbug_$qid") ? 1 : 0;
$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;
}
if ( ($o_sort ne $sort) || if ( ($o_sort != $sort) ||
($o_queryname ne $queryname) || ($o_queryname ne $queryname) ||
($o_onemailperbug xor $onemailperbug) || ($o_onemailperbug != $onemailperbug) ||
($o_title ne $title) ){ ($o_title ne $title) ){
detaint_natural($sort) if length $sort; detaint_natural($sort);
trick_taint($queryname) if length $queryname; trick_taint($queryname);
trick_taint($title) if length $title; trick_taint($title);
trick_taint($onemailperbug) if length $onemailperbug;
$sth = $dbh->prepare("UPDATE whine_queries " . $sth = $dbh->prepare("UPDATE whine_queries " .
"SET sortkey=?, " . "SET sortkey=?, " .
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment