about summary refs log tree commit diff
path: root/irc.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2021-08-15 12:24:15 -0400
committerJune McEnroe <june@causal.agency>2021-08-15 12:24:15 -0400
commitdf1e5613786ab7e0a40a42bd339e30355bc75165 (patch)
tree15ff21d2fb2f7fa121115694c95a1c5cd8535cbf /irc.c
parentFix missing include for flock(2) (diff)
downloadtest-df1e5613786ab7e0a40a42bd339e30355bc75165.tar.gz
test-df1e5613786ab7e0a40a42bd339e30355bc75165.zip
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.
Diffstat (limited to '')
-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;
 			}
 		}
tle='2015-08-13 15:38:35 +0200'>2015-08-13ui-tree: use "sane" isgraph()John Keeping 2015-08-13cgit.h: move stdbool.h from ui-shared.hJohn Keeping 2015-08-13cache.c: fix header orderJohn Keeping 2015-08-13configfile.c: don't include system headers directlyJohn Keeping 2015-08-13Remove redundant includesJohn Keeping 2015-08-13Makefile: include Git's config.mak.unameJohn Keeping 2015-08-13tests: allow shell to be overriddenJohn Keeping 2015-08-13redirect: cleanlinessJason A. Donenfeld 2015-08-13redirect: be more careful for different cgi setupsJason A. Donenfeld 2015-08-12ui-log: fix double countingJohn Keeping 2015-08-12log: allow users to follow a fileJohn Keeping 2015-08-12shared: make cgit_diff_tree_cb publicJohn Keeping 2015-08-12t0110: Chain together using &&Jason A. Donenfeld 2015-08-12about: always ensure page has a trailing slashJason A. Donenfeld 2015-08-12filters: apply HTML escapingLazaros Koromilas 2015-08-12git: update to v2.5.0Christian Hesse 2015-08-12Fix processing of repo.hide and repo.ignoreDaniel Reichelt