From fc888ece449bca0362696d561cb0887b128e045d Mon Sep 17 00:00:00 2001 From: Philipp Takacs Date: Sun, 14 May 2023 02:12:49 +0200 Subject: [PATCH] fix threadid NULL deref strchr returns NULL if the character is not found. --- sbr/getthreadid.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sbr/getthreadid.c b/sbr/getthreadid.c index a1ad7a0..abac78d 100644 --- a/sbr/getthreadid.c +++ b/sbr/getthreadid.c @@ -54,8 +54,11 @@ threadid(char *msgid, char *referens) } start = strchr(threadfrom, '<'); + if (!start) { + return NULL; + } end = strchr(start, '>'); - if (!(*start) || !(*end)) { + if (!end) { return NULL; } *end = '\0'; -- 1.7.10.4