summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-02-26 02:28:35 -0500
committerJune McEnroe <june@causal.agency>2020-02-26 02:37:10 -0500
commitfe437b2ea18df5ecd1baa5086ccc1e866af21df5 (patch)
tree55084737d377d8f99d38fa7cc46868a90975d5aa
parentAdd time tag to lines missing it (diff)
downloadpounce-fe437b2ea18df5ecd1baa5086ccc1e866af21df5.tar.gz
pounce-fe437b2ea18df5ecd1baa5086ccc1e866af21df5.zip
Tweak buffer sizes
Filter functions are dealing with lines not including CRLF, so they
already have extra space. serverFormat is using snprintf which wants to
always write a NUL at the end of the string.
-rw-r--r--client.c6
-rw-r--r--server.c2
2 files changed, 4 insertions, 4 deletions
diff --git a/client.c b/client.c
index 9b55fdd..2405004 100644
--- a/client.c
+++ b/client.c
@@ -426,7 +426,7 @@ static const char *filterChghost(const char *line) {
 static const char *filterExtendedJoin(const char *line) {
 	if (wordcmp(line, 1, "JOIN")) return line;
 	static regex_t regex;
-	static char buf[MessageCap + 1];
+	static char buf[MessageCap];
 	return snip(buf, sizeof(buf), line, compile(&regex, "(JOIN [^ ]+).+"));
 }
 
@@ -440,7 +440,7 @@ static const char *filterMessageTags(const char *line) {
 }
 
 static const char *filterMultiPrefix(const char *line) {
-	static char buf[MessageCap + 1];
+	static char buf[MessageCap];
 	if (!wordcmp(line, 1, "352")) {
 		static regex_t regex;
 		return snip(
@@ -461,7 +461,7 @@ static const char *filterMultiPrefix(const char *line) {
 static const char *filterUserhostInNames(const char *line) {
 	if (wordcmp(line, 1, "353")) return line;
 	static regex_t regex;
-	static char buf[MessageCap + 1];
+	static char buf[MessageCap];
 	return snip(
 		buf, sizeof(buf), line,
 		compile(&regex, "( :?[^!]+)![^ ]+")
diff --git a/server.c b/server.c
index abc7d40..20d94e3 100644
--- a/server.c
+++ b/server.c
@@ -139,7 +139,7 @@ void serverSend(const char *ptr, size_t len) {
 }
 
 void serverFormat(const char *format, ...) {
-	char buf[MessageCap];
+	char buf[MessageCap + 1];
 	va_list ap;
 	va_start(ap, format);
 	int len = vsnprintf(buf, sizeof(buf), format, ap);
ll script yet againJune McEnroe 2020-09-11Remove NetBSD from install scriptJune McEnroe I never use it. 2020-09-11Use MacPorts rather than pkgsrcJune McEnroe My system is probably such a mess now... 2020-09-11Add debian VM name to sshJune McEnroe 2020-09-11Add influencer tweetJune McEnroe 2020-09-10Add The Kingdom of GodsJune McEnroe Reading has really slowed down :( 2020-09-07Add SunglassesJune McEnroe An IRC find. 2020-09-06Add Between the BreathsJune McEnroe One of those good songs from a soundtrack of a film that probably isn't? The summary sounds a lot more interesting than the title implies, at least. 2020-09-04Open /dev/tty in nudgeJune McEnroe This makes it work even when it's run connected to a pipe, i.e. as the notify command of catgirl... 2020-09-04Add nudgeJune McEnroe 2020-09-03Build fbclock with -lzJune McEnroe I guess this got lost somewhere, long ago... 2020-08-29Add tweets from retweetsJune McEnroe