Are functions like strcpy, gets, etc. always dangerous? What if I write a code like this:
int main(void) { char *str1 = \"abcdefghijklmnop\"; char *str2 = m
Your code is not safe. The return value of malloc is unchecked, if it fails and returns 0 the strcpy will give undefined behavior.
malloc
strcpy
Besides that, I see no problem other than that the example basically does not do anything.