C++: Can function pointers be traced back to the original function before compilation without looking at the function name? -


i want set server on students can upload , run code course. however, don't want them access various functions, system(), allow bad access server. can search pre-processor output explicit function call, if user makes function pointer this:

int (*syst)(const char*) = system; syst("rm *"); 

i'm still open threat. however, can't search string "system", example, since it's otherwise valid name - if student didn't include cstdlib, use name variable name. since beginning programming course, having blacklist of variable names ten miles long bad idea.

is there way define functions other name , allow me search other designation before compiling code?

by far easiest solution compile code - that's pretty harmless - , @ actual library imports. users may have defined own system, wouldn't cause system imported glibc.

showing imported symbols

the main reason can't @ raw source code because #define allows malicious users hide blacklisted symbol names. there plenty of other possibilities that, including

auto hidden = &sys\ tem; 

so need processing of source, , it's easiest process whole source.


Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -