Skip to content

Commit ab51b4e

Browse files
committed
Close the metadata file in the child process
This prevents the submission from writing to the metadata file, which allows it to e.g. override runtime and whether the time limit was hit. Thanks Atsutoshi Kikuchi for reporting. (cherry picked from commit 935bea5)
1 parent 882a674 commit ab51b4e

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

ChangeLog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
DOMjudge Programming Contest Judging System
22

3+
Version 8.2.3DEV
4+
----------------
5+
- [security] Close metadata file descriptor for the child in runguard.
6+
37
Version 8.2.2 - 20 October 2023
48
-------------------------------
59
- Bugfix to prevent errors when running a bare-install or deleting all

judge/runguard.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1242,6 +1242,13 @@ int main(int argc, char **argv)
12421242
}
12431243
verbose("pipes closed in child");
12441244

1245+
if ( outputmeta ) {
1246+
if ( fclose(metafile)!=0 ) {
1247+
error(errno,"closing file `%s'",metafilename);
1248+
}
1249+
verbose("metafile closed in child");
1250+
}
1251+
12451252
/* And execute child command. */
12461253
execvp(cmdname,cmdargs);
12471254
error(errno,"cannot start `%s'",cmdname);

0 commit comments

Comments
 (0)