Don't pass NULL input to strchr.
More checks.
This should also be safer.
Miscellaneous improvements to parsing.

Making some slight progress.