diff options
author | June McEnroe <june@causal.agency> | 2021-08-15 12:24:15 -0400 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2021-08-15 12:24:15 -0400 |
commit | df1e5613786ab7e0a40a42bd339e30355bc75165 (patch) | |
tree | 15ff21d2fb2f7fa121115694c95a1c5cd8535cbf /irc.c | |
parent | Fix missing include for flock(2) (diff) | |
download | catgirl-1.9a.tar.gz catgirl-1.9a.zip |
Handle tags without values 1.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.
Diffstat (limited to '')
-rw-r--r-- | irc.c | 8 |
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; } } |