I am getting segmentation fault after strcpy(buffer_two, argv[1]); Not sure what's going wrong here and i would appreciate a hand to understand what's wrong and why i get that segmentation fault.
#include <stdio.h>
#include <string.h>
int main(int argc, char *argv[])
{
int value = 5;
char buffer_one[8], buffer_two[8];
strcpy(buffer_one, "one"); // Put "one" into buffer_one
strcpy(buffer_two, "two"); // Put "two" into buffer_two
printf("[BEFORE] buffer_two is at %p and contains \'%s\'\n", buffer_two, buffer_two);
printf("[BEFORE] buffer_one is at %p and contains \'%s\'\n", buffer_one, buffer_one);
printf("\n[STRCPY] copying %d bytes into buffer_two\n\n", strlen(argv[1])); //Copy first argument into buffer_two
strcpy(buffer_two, argv[1]); // <---- here
printf("[After] buffer_two is at %p and contains \'%s\'\n", buffer_two, buffer_two);
printf("[After] buffer_one is at %p and contains \'%s\'\n", buffer_one, buffer_one);
printf("[AFTER] value is at %p and is %d (0x%08x)\n", &value, value, value);
}