Notes
This function is in beta test. Please help improve it in the issues
here.
$ ./ex3_memory_check rand_char*.txt dec ================================================================= ==40438==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x602000000036 at pc 0x0000004adb4c bp 0x7ffe8df30750 sp 0x7ffe8df2ff00 WRITE of size 7 at 0x602000000036 thread T0 #0 0x4adb4b (/out/package/ex3_memory_check+0x4adb4b) #1 0x515218 (/out/package/ex3_memory_check+0x515218) #2 0x5177df (/out/package/ex3_memory_check+0x5177df) #3 0x7f2678f25b96 (/lib/x86_64-linux-gnu/libc.so.6+0x21b96) #4 0x41cb19 (/out/package/ex3_memory_check+0x41cb19) 0x602000000036 is located 0 bytes to the right of 6-byte region [0x602000000030,0x602000000036) allocated by thread T0 here: #0 0x4dc9d0 (/out/package/ex3_memory_check+0x4dc9d0) #1 0x5151f8 (/out/package/ex3_memory_check+0x5151f8) #2 0x5177df (/out/package/ex3_memory_check+0x5177df) #3 0x7f2678f25b96 (/lib/x86_64-linux-gnu/libc.so.6+0x21b96) SUMMARY: AddressSanitizer: heap-buffer-overflow (/out/package/ex3_memory_
Hints
Your answer may be identical to the JOJ answer in the first several lines.
However, the main problem you meet now is Runtime Error. And the exit code of your program is 1, which should be 0.
Please double check your code to solve this problem and try again.
Your Answer
Program exit with non zero value 1!
JOJ Answer
Correct!