WiP
[oweals/gnunet.git] / src / monkey / bug_null_pointer_exception.c
index 977fb088c364af74511b15430ddc567c1300362f..4accd65af60e9b169359fe9447a5539be010958d 100644 (file)
@@ -1,27 +1,21 @@
 #include <stdio.h>
 #include <string.h>
 
+
+struct CrashStruct {
+       const char *crashValue;
+};
+
 void crashFunction() 
 {
-       //char *stringCannotBeChanged = "String cannot be changed!";
-       char *nullString = NULL;
-       
-       printf("Now the program will crash! Take a cover! \n");
-       //*stringCannotBeChanged = 'h';
-       printf("Nonsense!\n");
-       if (strcmp(nullString, "A string to compare with") == 0) {
-               printf("How come?! It had to be crashed!\n");
-       }
+       struct CrashStruct *crashStruct;
+       crashStruct = NULL;
+       printf("Now the program will crash!\n");
+       crashStruct->crashValue = "hello!";
 }
 
 int main(int argc, char *argv[]) 
 {
-       int i;
-       printf("arguments: %d\n", argc);
-       for (i=0; i<argc; i++)
-               printf("%d: %s\n", i, argv[i]);
-       printf("Press ENTER\n");
-       getchar();
        crashFunction();
        return 0;
 }