Skip to content

Commit 74b48c4

Browse files
author
Li
committed
cgi-bin/result.cgi jobid format check
1 parent acfead7 commit 74b48c4

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

cgi-bin/result.cgi

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@ EOD
3434

3535
my $base_cgi = "/cgi-bin/index.cgi";
3636
my $JOBID = $q->param('JOBID');
37+
$JOBID =~ s/\s+//g;
3738

39+
security_check($JOBID);
40+
3841
if (defined $q->param('side')){
3942
if ($q->param('side') eq 'left' ) {result_left($JOBID);}
4043
else {result_right($JOBID);}
@@ -46,6 +49,17 @@ if (-f "$SL_session_dir/$JOBID/$JOBID.ok") { completed_job($JOBID);}
4649
if (-d "$SL_session_dir/$JOBID") { running_job($JOBID); }
4750
unknown_job($JOBID);
4851

52+
sub security_check{
53+
my $JOBID = shift;
54+
if ($JOBID =~ /\D/) {
55+
print $q->header("text/html");
56+
print "Invalid job id";
57+
print $q->end_html;
58+
59+
exit();
60+
}
61+
}
62+
4963
sub failed_job{
5064
my $JOBID = shift;
5165
print $q->header("text/html");

0 commit comments

Comments
 (0)