about summary refs log tree commit diff
diff options
context:
space:
mode:
-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];
 }