Crash the program with cmd line args

Posted by Debanjan on Stack Overflow See other posts from Stack Overflow or by Debanjan
Published on 2010-04-23T19:47:10Z Indexed on 2010/04/23 20:03 UTC
Read the original article Hit count: 195

Filed under:
|
|

Lets us consider the following program :

#include <stdlib.h>

int main(int argc, char **argv){
   int a,b;

   if (argc != 3)
       return -1;

   a = atoi(argv[1]);
   b = atoi(argv[2]);

   a = b ? a/b : 0;

   return a;
}

The task is to crash the program by providing arguments in command-line.

© Stack Overflow or respective owner

Related posts about c

    Related posts about c++