ioi / isolate

Sandbox for securely executing untrusted programs
Other
1.04k stars 154 forks source link

cg2: Use strdup for saving cf_cg_root value from file #143

Closed AlexVasiluta closed 6 months ago

AlexVasiluta commented 6 months ago

It seems that on Fedora systems, probably due to some hardening features, memory malloc-ed by the getline() call when trying to parse the file (when the cgroup root path is in auto mode) is improperly handled after the clone call. Instead of directly setting the pointer to that memory, using strdup again seems to do the trick and properly allocate memory just for the string.

In addition, this makes the setup of the cf_cg_root variable consistent with config.c, in which it is also strdup-ed in the cf_string function.

If accepted, this pull request can close #142.

gollux commented 6 months ago

Applied. Thanks!