From 513a33f8bfc95d4d177462be6a8fba5bc0b82d27 Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Thu, 22 Apr 2021 22:24:44 -0400 Subject: Handle trailing comments in message IDs Apparently some clients put a comment after the (like this). --- parse.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/parse.c b/parse.c index da1ba47..8bfae61 100644 --- a/parse.c +++ b/parse.c @@ -59,11 +59,11 @@ static struct AddressList parseAddressList(struct List list) { static char *parseID(char *id) { while (isspace(id[0])) id++; - size_t len = strlen(id); - if (id[0] != '<' || !len || id[len - 1] != '>') { + size_t len = strcspn(id, ">"); + if (id[0] != '<' || !len || id[len] != '>') { errx(EX_PROTOCOL, "invalid message ID"); } - id[len - 1] = '\0'; + id[len] = '\0'; return &id[1]; } -- cgit 1.4.1