All these functions, StrmyUFgets, StrISgets, etc. can potentially return NULL. Add a check for it.
This if is only true if both strchr return NULL, making sure that *q is a NULL dereference. The intention was to remove trailing '>' (or '\t') from the message-id (p) for add_news_message(). Adjust the condition.