简体   繁体   中英

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM