about summary refs log tree commit diff
path: root/handle.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--handle.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/handle.c b/handle.c
index c602c23..7fba7f2 100644
--- a/handle.c
+++ b/handle.c
@@ -152,8 +152,10 @@ static void handle366(char *prefix, char *params) {
 	ircFmt("WHO %s\r\n", chan);
 }
 
-static char whoBuf[4096];
-static size_t whoLen;
+static struct {
+	char buf[4096];
+	size_t len;
+} who;
 
 static void handle352(char *prefix, char *params) {
 	(void)prefix;
@@ -163,21 +165,23 @@ static void handle352(char *prefix, char *params) {
 	shift(&params);
 	shift(&params);
 	char *nick = shift(&params);
-	whoLen += snprintf(
-		&whoBuf[whoLen], sizeof(whoBuf) - whoLen,
+	size_t cap = sizeof(who.buf) - who.len;
+	int len = snprintf(
+		&who.buf[who.len], cap,
 		"%s\3%d%s\3",
-		(whoLen ? ", " : ""), color(user), nick
+		(who.len ? ", " : ""), color(user), nick
 	);
+	if ((size_t)len < cap) who.len += len;
 }
 
 static void handle315(char *prefix, char *params) {
 	(void)prefix;
 	shift(&params);
 	char *chan = shift(&params);
-	whoLen = 0;
+	who.len = 0;
 	uiFmt(
 		L"In \3%d%s\3 are %s",
-		color(chan), chan, whoBuf
+		color(chan), chan, who.buf
 	);
 }
 
5-25import: Add missing scripts/wrap-compiler-for-flag-checkJune McEnroe 2021-05-08Import LibreSSL 3.3.3June McEnroe 2021-04-18build: Remove added x509_verify.3 links 3.3.2June McEnroe 2021-04-18tls: Use EC_KEY_set_ex_dataJune McEnroe 2021-04-18Import LibreSSL 3.3.2June McEnroe 2021-03-05Bump version to 3.3.1p1 3.3.1p1June McEnroe 2021-03-05build: Add OpenSSL includes to libcompatJune McEnroe 2020-12-15Import LibreSSL 3.3.1June McEnroe 2020-11-24Import LibreSSL 3.3.0June McEnroe 2020-10-22Import LibreSSL 3.2.2June McEnroe 2020-09-29Import LibreSSL 3.2.1June McEnroe 2020-09-29import: Add m4/ax_add_fortify_source.m4June McEnroe 2020-08-05build: Add README.7 to EXTRA_DIST 3.2.0June McEnroe 2020-08-03doc: Indicate that only OpenSSL 1.1.1b and newer workJune McEnroe