returns a pointer to the next token or
. If it returns
then the call to
will fail because you have passed it an invalid pointer. Your code should read:
cp = strtok(NULL, hash);
if (cp == NULL)
Note that you have similar bugs elsewhere in your code; you must check that the return from
is non-null before passing it to any other function.