Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
bugzilla
Commits
c594d00a
Commit
c594d00a
authored
Apr 16, 2002
by
bbaetz%student.usyd.edu.au
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 125427 - Taint error in duplicates.cgi with perl < 5.6
r=gerv, myk
parent
f44a3d6f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
19 deletions
+39
-19
duplicates.cgi
duplicates.cgi
+39
-19
No files found.
duplicates.cgi
View file @
c594d00a
...
@@ -69,20 +69,36 @@ $sortby = "count" if $sortby eq "dup_count";
...
@@ -69,20 +69,36 @@ $sortby = "count" if $sortby eq "dup_count";
my
$today
=
days_ago
(
0
);
my
$today
=
days_ago
(
0
);
my
$yesterday
=
days_ago
(
1
);
my
$yesterday
=
days_ago
(
1
);
if
(
<
data
/duplicates/
dupes$today
*>
)
{
# We don't know the exact file name, because the extention depends on the
dbmopen
(
%
dbmcount
,
"data/duplicates/dupes$today"
,
0644
)
# underlying dbm library, which could be anything. We can't glob, because
||
DisplayError
(
"Can't open today ($today)'s dupes file: $!"
)
# perl < 5.6 considers if (<*>) { ... } to be tainted
&&
exit
;
# Instead, just check the return value for today's data and yesterday's,
}
# and ignore file not found errors
elsif
(
<
data
/duplicates/
dupes$yesterday
*>
)
{
dbmopen
(
%
dbmcount
,
"data/duplicates/dupes$yesterday"
,
0644
)
use
Errno
;
||
DisplayError
(
"Can't open yesterday ($yesterday)'s dupes file: $!"
)
use
Fcntl
;
&&
exit
;
}
if
(
!
tie
(
%
dbmcount
,
'AnyDBM_File'
,
"data/duplicates/dupes$today"
,
else
{
O_RDONLY
,
0644
))
{
DisplayError
(
"There are no duplicate statistics for today ($today) or
if
(
$!
{
ENOENT
})
{
yesterday."
);
if
(
!
tie
(
%
dbmcount
,
'AnyDBM_File'
,
"data/duplicates/dupes$yesterday"
,
exit
;
O_RDONLY
,
0644
))
{
if
(
$!
{
ENOENT
})
{
ThrowUserError
(
"There are no duplicate statistics for today "
.
"($today) or yesterday."
,
"Cannot find duplicate statistics"
);
}
else
{
ThrowUserError
(
"There are no duplicate statistics for today "
.
"($today), and an error occurred when "
.
"accessing yesterday's dupes file: $!."
,
"Error reading yesterday's dupes file"
);
}
}
}
else
{
ThrowUserError
(
"An error occurred when accessing today ($today)'s "
.
"dupes file: $!."
,
"Error reading today's dupes file"
);
}
}
}
# Copy hash (so we don't mess up the on-disk file when we remove entries)
# Copy hash (so we don't mess up the on-disk file when we remove entries)
...
@@ -101,11 +117,15 @@ my $dobefore = 0;
...
@@ -101,11 +117,15 @@ my $dobefore = 0;
my
%
delta
;
my
%
delta
;
my
$whenever
=
days_ago
(
$changedsince
);
my
$whenever
=
days_ago
(
$changedsince
);
if
(
<
data
/duplicates/
dupes$whenever
*>
)
{
if
(
!
tie
(
%
before
,
'AnyDBM_File'
,
"data/duplicates/dupes$whenever"
,
dbmopen
(
%
before
,
"data/duplicates/dupes$whenever"
,
0644
)
O_RDONLY
,
0644
))
{
||
DisplayError
(
"Can't open $changedsince days ago ($whenever)'s "
.
# Ignore file not found errors
"dupes file: $!"
);
if
(
!
$!
{
ENOENT
})
{
ThrowUserError
(
"Can't open $changedsince days ago ($whenever)'s "
.
"dupes file: $!"
,
"Error reading previous dupes file"
);
}
}
else
{
# Calculate the deltas
# Calculate the deltas
(
$delta
{
$_
}
=
$count
{
$_
}
-
$before
{
$_
})
foreach
(
keys
(
%
count
));
(
$delta
{
$_
}
=
$count
{
$_
}
-
$before
{
$_
})
foreach
(
keys
(
%
count
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment