how to execute c code securely

前端 未结 4 479
有刺的猬
有刺的猬 2021-01-28 11:46

In this scenario the user will submit his/her C code to my server through a browser. The code will then be compiled and executed on my server and the output will be sent to the

4条回答
  •  长情又很酷
    2021-01-28 12:04

    Your question is perhaps equivalent to the halting problem, and probably has no bullet proof answer (think of asm in malicious C code, forged function pointers, computed goto, buffer overflow trashing the return address, dlsym & dlopen, etc.).

    As mentioned by Shawn in his comment (referring to this question), you could use sand-boxing techniques. Alinsoar's answer shows you the complexity of the issue.

提交回复
热议问题