Posted By

blackthorne on 01/04/11


Tagged

system popen execve


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

blackthorne


Execve() for executing external programs


 / Published in: C
 

To execute external programs you should avoid functions like system() or popen() since they can be affected by the shell environment variables which issues serious security concerns. Instead, use execve().

  1. #include <unistd.h>
  2. int main(int argc,char **argv){
  3. execve("/bin/ls", &argv[0], NULL);
  4. return 0;
  5. }

Report this snippet  

You need to login to post a comment.