Attempting to dereference a null pointer results in undefined behavior, typically abnormal program termination.
...
Noncompliant Code Example
In this example, input_str is copied into dynamically allocated memory referenced by str. If malloc() fails, it returns a null pointer that is assigned to str. When str is dereferenced in memcpy(), the program behaves in an unpredictable manner.
...