about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2021-04-22 22:24:44 -0400
committerJune McEnroe <june@causal.agency>2021-04-22 22:24:44 -0400
commit513a33f8bfc95d4d177462be6a8fba5bc0b82d27 (patch)
tree563e1d61466b88f5e79b0613958450a18b8b8235
parentDon't URL-encode fragment links (diff)
downloadbubger-513a33f8bfc95d4d177462be6a8fba5bc0b82d27.tar.gz
bubger-513a33f8bfc95d4d177462be6a8fba5bc0b82d27.zip
Handle trailing comments in message IDs
Apparently some clients put a comment after the <messageID> (like this).
-rw-r--r--parse.c6
1 files 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];
 }