We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e982562 commit ad1ff02Copy full SHA for ad1ff02
judge/runguard.cc
@@ -806,12 +806,14 @@ void setrestrictions()
806
807
/* Set additional environment variables. */
808
for (const auto &tokens : environment_variables) {
809
- char *token = strtok(strdup(tokens.c_str()), ";");
+ char *tokens_dup = strdup(tokens.c_str());
810
+ char *token = strtok(tokens_dup, ";");
811
while (token != nullptr) {
812
verbose("setting environment variable: %s", token);
813
putenv(token);
814
token = strtok(nullptr, ";");
815
}
816
+ free(tokens_dup);
817
818
819
/* Set resource limits: must be root to raise hard limits.
0 commit comments