summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorC. McEnroe2021-08-15 12:24:15 -0400
committerC. McEnroe2021-08-15 12:24:15 -0400
commitdf1e5613786ab7e0a40a42bd339e30355bc75165 (patch)
tree15ff21d2fb2f7fa121115694c95a1c5cd8535cbf
parent3f3585d0f32e66ad5c8c6c713f315e14810230eb (diff)
Handle tags without values1.9a
Otherwise a tag with no value would cause a segfault trying to unescape the NULL tag pointer. This shouldn't happen for the server tags we parse, but clients could send @+draft/reply with no value.
-rw-r--r--irc.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/irc.c b/irc.c
index 2d7f23d..8d5ae81 100644
--- a/irc.c
+++ b/irc.c
@@ -250,8 +250,12 @@ static struct Message parse(char *line) {
char *key = strsep(&tag, "=");
for (uint i = 0; i < TagCap; ++i) {
if (strcmp(key, TagNames[i])) continue;
- unescape(tag);
- msg.tags[i] = tag;
+ if (tag) {
+ unescape(tag);
+ msg.tags[i] = tag;
+ } else {
+ msg.tags[i] = "";
+ }
break;
}
}