about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2023-02-07 11:17:15 -0500
committerJune McEnroe <june@causal.agency>2023-02-07 11:17:15 -0500
commitd410e03ca334140760b7ee9ad356d6f035e2563e (patch)
tree1e7a9645493d4f088e56bdc75a36b482d3385ccb
parentCheck local-pass and sasl-plain in edit (diff)
downloadpounce-d410e03ca334140760b7ee9ad356d6f035e2563e.tar.gz
pounce-d410e03ca334140760b7ee9ad356d6f035e2563e.zip
Fix segfault parsing line with only tags
-rw-r--r--bounce.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/bounce.h b/bounce.h
index e196ed0..93a3c89 100644
--- a/bounce.h
+++ b/bounce.h
@@ -69,8 +69,8 @@ struct Message {
 
 static inline struct Message parse(char *line) {
 	struct Message msg = {0};
-	if (line[0] == '@') msg.tags = 1 + strsep(&line, " ");
-	if (line[0] == ':') msg.origin = 1 + strsep(&line, " ");
+	if (line && line[0] == '@') msg.tags = 1 + strsep(&line, " ");
+	if (line && line[0] == ':') msg.origin = 1 + strsep(&line, " ");
 	msg.cmd = strsep(&line, " ");
 	for (size_t i = 0; line && i < ParamCap; ++i) {
 		if (line[0] == ':') {