Remove null pointer dereference

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.
This commit is contained in:
Rene Kita
2021-12-28 14:25:19 +01:00
parent fa6da6a0fa
commit 22d1fb47ac

2
news.c
View File

@@ -443,7 +443,7 @@ loadNewsgroup0(ParsedURL *pu)
continue;
if (*p == '<')
p++;
if (!(q = strchr(p, '>')) && !(q = strchr(p, '\t')))
if ((q = strchr(p, '>')) || (q = strchr(p, '\t')))
*q = '\0';
if (!(s = checkHeader(buf, "Subject:")))
continue;