Handle tags without values
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.weechat-hashes
parent
3f3585d0f3
commit
df1e561378
4
irc.c
4
irc.c
|
@ -250,8 +250,12 @@ static struct Message parse(char *line) {
|
||||||
char *key = strsep(&tag, "=");
|
char *key = strsep(&tag, "=");
|
||||||
for (uint i = 0; i < TagCap; ++i) {
|
for (uint i = 0; i < TagCap; ++i) {
|
||||||
if (strcmp(key, TagNames[i])) continue;
|
if (strcmp(key, TagNames[i])) continue;
|
||||||
|
if (tag) {
|
||||||
unescape(tag);
|
unescape(tag);
|
||||||
msg.tags[i] = tag;
|
msg.tags[i] = tag;
|
||||||
|
} else {
|
||||||
|
msg.tags[i] = "";
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue