Closed ghost closed 6 years ago
The call to strtok may return a NULL pointer if the input string contains only the separator (in this case, a space). A check is needed before passing this pointer to strlen to prevent a segmentation fault (caused by the read at 0x0).
strtok
strlen
The call to
strtok
may return a NULL pointer if the input string contains only the separator (in this case, a space). A check is needed before passing this pointer tostrlen
to prevent a segmentation fault (caused by the read at 0x0).