Moein Hosseini
Moein Hosseini

Reputation: 4383

compile c/c++ online [security issue]

I'm trying to compile c/c++ program online by gcc compiler. when user enter c/c++ code,I will make temp file (temp.cpp) and after that I will compile it by

 exce('gcc temp.cpp'); 
php function.after that I will run it by exce() function too. now how can I sure user c/c++ code don't be to hurt my website?how can I prevent to access files,database,killing process and ... that can be done by C/C++ program?

Upvotes: 1

Views: 504

Answers (1)

Seth Carnegie
Seth Carnegie

Reputation: 75130

As long as you don't execute the compiled program on your server, it's fine.

If you do run the program on your server, then you'll have to sandbox it, which can be difficult. See codepad's about page to see how they do it.

Upvotes: 6

Related Questions