From e52893db934d9c0245cba0e193db5660e1e81866 Mon Sep 17 00:00:00 2001 From: Simon Arlott Date: Sun, 15 Sep 2019 10:57:53 +0100 Subject: [PATCH] Fix GCC 8 compiler warnings --- bandb/bantool.c | 7 +++++-- extensions/ip_cloaking_3.0.c | 4 ++-- extensions/m_roleplay.c | 2 +- ircd/supported.c | 4 ++-- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/bandb/bantool.c b/bandb/bantool.c index f4547eb9..3496b423 100644 --- a/bandb/bantool.c +++ b/bandb/bantool.c @@ -230,8 +230,11 @@ main(int argc, char *argv[]) /* checking for our files to import or export */ for(i = 0; i < LAST_BANDB_TYPE; i++) { - snprintf(conf, sizeof(conf), "%s/%s.conf%s", - etc, bandb_table[i], bandb_suffix[i]); + if (snprintf(conf, sizeof(conf), "%s/%s.conf%s", + etc, bandb_table[i], bandb_suffix[i]) >= sizeof(conf)) { + fprintf(stderr, "* Error: Config filename too long\n"); + exit(EXIT_FAILURE); + } if(flag.import && flag.pretend == false) rsdb_transaction(RSDB_TRANS_START); diff --git a/extensions/ip_cloaking_3.0.c b/extensions/ip_cloaking_3.0.c index e648fc1b..2b6f2dcb 100644 --- a/extensions/ip_cloaking_3.0.c +++ b/extensions/ip_cloaking_3.0.c @@ -125,11 +125,11 @@ do_host_cloak_ip(const char *inbuf, char *outbuf) if(ipv6) { - snprintf(outbuf, HOSTLEN, "%s:%x", buf, accum); + snprintf(outbuf, HOSTLEN, "%.60s:%x", buf, accum); } else { - snprintf(outbuf, HOSTLEN, "%s.%x", buf, accum); + snprintf(outbuf, HOSTLEN, "%.60s.%x", buf, accum); } } diff --git a/extensions/m_roleplay.c b/extensions/m_roleplay.c index a7cfaf10..0f26942c 100644 --- a/extensions/m_roleplay.c +++ b/extensions/m_roleplay.c @@ -199,7 +199,7 @@ m_displaymsg(struct MsgBuf *msgbuf_p, struct Client *source_p, const char *chann snprintf(text3, sizeof(text3), "%s (%s)", text, source_p->name); if(action) - snprintf(text2, sizeof(text2), "\1ACTION %s\1", text3); + snprintf(text2, sizeof(text2), "\1ACTION %.500s\1", text3); else snprintf(text2, sizeof(text2), "%s", text3); diff --git a/ircd/supported.c b/ircd/supported.c index d8f176ce..09de6ce0 100644 --- a/ircd/supported.c +++ b/ircd/supported.c @@ -236,7 +236,7 @@ isupport_umode(const void *ptr) static const char * isupport_chanmodes(const void *ptr) { - static char result[80]; + static char result[300]; snprintf(result, sizeof result, "%s%sbq,k,%slj,%s", ConfigChannel.use_except ? "e" : "", @@ -249,7 +249,7 @@ isupport_chanmodes(const void *ptr) static const char * isupport_chanlimit(const void *ptr) { - static char result[30]; + static char result[BUFSIZE + 30]; snprintf(result, sizeof result, "%s:%i", allowed_chantypes, ConfigChannel.max_chans_per_user); return result;