summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-04-05 13:00:05 -0400
committerJune McEnroe <june@causal.agency>2020-04-05 13:00:05 -0400
commite7f73d66da51be79776c9c28ed4738a5635a1c8a (patch)
treee42b324c9645ef3fc9a79ef764c4f79ebc4ae378
parentOnly set RCS on FreeBSD (diff)
downloadlitterbox-1.2.tar.gz
litterbox-1.2.zip
Error on invalid ISUPPORT values 1.2
Diffstat (limited to '')
-rw-r--r--litterbox.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/litterbox.c b/litterbox.c
index 4a65166..08b98ac 100644
--- a/litterbox.c
+++ b/litterbox.c
@@ -177,12 +177,22 @@ static void handleReplyISupport(struct Message *msg) {
 			set(&chanTypes, msg->params[i]);
 		} else if (!strcmp(key, "PREFIX")) {
 			strsep(&msg->params[i], "(");
-			set(&prefixModes, strsep(&msg->params[i], ")"));
+			char *modes = strsep(&msg->params[i], ")");
+			if (!modes || !msg->params[i]) {
+				errx(EX_PROTOCOL, "invalid PREFIX value");
+			}
+			set(&prefixModes, modes);
 			set(&prefixes, msg->params[i]);
 		} else if (!strcmp(key, "CHANMODES")) {
-			set(&listModes, strsep(&msg->params[i], ","));
-			set(&paramModes, strsep(&msg->params[i], ","));
-			set(&setParamModes, strsep(&msg->params[i], ","));
+			char *list = strsep(&msg->params[i], ",");
+			char *param = strsep(&msg->params[i], ",");
+			char *setParam = strsep(&msg->params[i], ",");
+			if (!list || !param || !setParam) {
+				errx(EX_PROTOCOL, "invalid CHANMODES value");
+			}
+			set(&listModes, list);
+			set(&paramModes, param);
+			set(&setParamModes, setParam);
 		}
 	}
 }
x in uiReadJune McEnroe 2018-09-13Add IRCDefault to colors enumJune McEnroe 2018-09-13Return a format->split even at the end of the stringJune McEnroe 2018-09-13Fix weird tab-complete after commaJune McEnroe 2018-09-13Rewrite UI againJune McEnroe 2018-09-12Add note about C-oJune McEnroe 2018-09-12Use formatParse split to position input cursorJune McEnroe 2018-09-12Factor out IRC formatting parsingJune McEnroe 2018-09-11Add /help equivalent to /manJune McEnroe 2018-09-11Don't render every PM as a pingJune McEnroe 2018-09-11Add urlOpenMatchJune McEnroe 2018-09-10Depend on man.sh for chroot.tar targetJune McEnroe 2018-09-10Set LESSSECURE=1 in man.shJune McEnroe 2018-09-10Add /man commandJune McEnroe 2018-09-10Install man page in chrootJune McEnroe 2018-09-10Install man pageJune McEnroe 2018-09-10Split keys into subsections and document colorsJune McEnroe 2018-09-10Add "blank" lines to chatte.1June McEnroe 2018-09-10Document key bindings in chatte.1June McEnroe 2018-09-08Document slash commands in chatte.1June McEnroe