Fix GCC 8 compiler warnings

This commit is contained in:
Simon Arlott 2019-09-15 10:57:53 +01:00
parent b55caab91e
commit e52893db93
No known key found for this signature in database
GPG key ID: 49BFFEEFD4C3ED53
4 changed files with 10 additions and 7 deletions

View file

@ -230,8 +230,11 @@ main(int argc, char *argv[])
/* checking for our files to import or export */ /* checking for our files to import or export */
for(i = 0; i < LAST_BANDB_TYPE; i++) for(i = 0; i < LAST_BANDB_TYPE; i++)
{ {
snprintf(conf, sizeof(conf), "%s/%s.conf%s", if (snprintf(conf, sizeof(conf), "%s/%s.conf%s",
etc, bandb_table[i], bandb_suffix[i]); 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) if(flag.import && flag.pretend == false)
rsdb_transaction(RSDB_TRANS_START); rsdb_transaction(RSDB_TRANS_START);

View file

@ -125,11 +125,11 @@ do_host_cloak_ip(const char *inbuf, char *outbuf)
if(ipv6) if(ipv6)
{ {
snprintf(outbuf, HOSTLEN, "%s:%x", buf, accum); snprintf(outbuf, HOSTLEN, "%.60s:%x", buf, accum);
} }
else else
{ {
snprintf(outbuf, HOSTLEN, "%s.%x", buf, accum); snprintf(outbuf, HOSTLEN, "%.60s.%x", buf, accum);
} }
} }

View file

@ -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); snprintf(text3, sizeof(text3), "%s (%s)", text, source_p->name);
if(action) if(action)
snprintf(text2, sizeof(text2), "\1ACTION %s\1", text3); snprintf(text2, sizeof(text2), "\1ACTION %.500s\1", text3);
else else
snprintf(text2, sizeof(text2), "%s", text3); snprintf(text2, sizeof(text2), "%s", text3);

View file

@ -236,7 +236,7 @@ isupport_umode(const void *ptr)
static const char * static const char *
isupport_chanmodes(const void *ptr) isupport_chanmodes(const void *ptr)
{ {
static char result[80]; static char result[300];
snprintf(result, sizeof result, "%s%sbq,k,%slj,%s", snprintf(result, sizeof result, "%s%sbq,k,%slj,%s",
ConfigChannel.use_except ? "e" : "", ConfigChannel.use_except ? "e" : "",
@ -249,7 +249,7 @@ isupport_chanmodes(const void *ptr)
static const char * static const char *
isupport_chanlimit(const void *ptr) 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); snprintf(result, sizeof result, "%s:%i", allowed_chantypes, ConfigChannel.max_chans_per_user);
return result; return result;