diff options
author | Safey A.Halim <safey.allah@gmail.com> | 2011-04-15 10:02:28 +0000 |
---|---|---|
committer | Safey A.Halim <safey.allah@gmail.com> | 2011-04-15 10:02:28 +0000 |
commit | b1cb1306723f7e953548fb6c6ebe177bb4910948 (patch) | |
tree | d13a3a6448dcf8871f8b0c21aa6db6d851a1dfac /src/monkey/bug_null_pointer_exception.c | |
parent | a4116282805cac6b71bc72888ce0d314810fdeb0 (diff) | |
download | gnunet-b1cb1306723f7e953548fb6c6ebe177bb4910948.tar.gz gnunet-b1cb1306723f7e953548fb6c6ebe177bb4910948.zip |
Action API detects segmentation fault
Diffstat (limited to 'src/monkey/bug_null_pointer_exception.c')
-rw-r--r-- | src/monkey/bug_null_pointer_exception.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/monkey/bug_null_pointer_exception.c b/src/monkey/bug_null_pointer_exception.c index 072904b6d..4accd65af 100644 --- a/src/monkey/bug_null_pointer_exception.c +++ b/src/monkey/bug_null_pointer_exception.c | |||
@@ -1,13 +1,17 @@ | |||
1 | #include <stdio.h> | 1 | #include <stdio.h> |
2 | #include <string.h> | 2 | #include <string.h> |
3 | 3 | ||
4 | |||
5 | struct CrashStruct { | ||
6 | const char *crashValue; | ||
7 | }; | ||
8 | |||
4 | void crashFunction() | 9 | void crashFunction() |
5 | { | 10 | { |
6 | char *nullString = NULL; | 11 | struct CrashStruct *crashStruct; |
12 | crashStruct = NULL; | ||
7 | printf("Now the program will crash!\n"); | 13 | printf("Now the program will crash!\n"); |
8 | if (strcmp(nullString, "A string to compare with") == 0) { | 14 | crashStruct->crashValue = "hello!"; |
9 | printf("How come?! It had to crash!\n"); | ||
10 | } | ||
11 | } | 15 | } |
12 | 16 | ||
13 | int main(int argc, char *argv[]) | 17 | int main(int argc, char *argv[]) |