gcc7 fixes: NICKLEN -> NAMELEN

Use NAMELEN instead of NICKLEN when accessing Client->name because it
could in theory be a HOSTLEN length string.
This commit is contained in:
Simon Arlott 2018-01-19 23:24:55 +00:00
parent 30053ab982
commit fe5fc851aa
No known key found for this signature in database
GPG key ID: 49BFFEEFD4C3ED53
8 changed files with 24 additions and 22 deletions

View file

@ -539,10 +539,10 @@ is_banned_list(struct Channel *chptr, rb_dlink_list *list,
struct Client *who, struct membership *msptr,
const char *s, const char *s2, const char **forward)
{
char src_host[NICKLEN + USERLEN + HOSTLEN + 6];
char src_iphost[NICKLEN + USERLEN + HOSTLEN + 6];
char src_althost[NICKLEN + USERLEN + HOSTLEN + 6];
char src_ip4host[NICKLEN + USERLEN + HOSTLEN + 6];
char src_host[NAMELEN + USERLEN + HOSTLEN + 6];
char src_iphost[NAMELEN + USERLEN + HOSTLEN + 6];
char src_althost[NAMELEN + USERLEN + HOSTLEN + 6];
char src_ip4host[NAMELEN + USERLEN + HOSTLEN + 6];
char *s3 = NULL;
char *s4 = NULL;
struct sockaddr_in ip4;
@ -722,9 +722,9 @@ can_join(struct Client *source_p, struct Channel *chptr, const char *key, const
rb_dlink_node *invite = NULL;
rb_dlink_node *ptr;
struct Ban *invex = NULL;
char src_host[NICKLEN + USERLEN + HOSTLEN + 6];
char src_iphost[NICKLEN + USERLEN + HOSTLEN + 6];
char src_althost[NICKLEN + USERLEN + HOSTLEN + 6];
char src_host[NAMELEN + USERLEN + HOSTLEN + 6];
char src_iphost[NAMELEN + USERLEN + HOSTLEN + 6];
char src_althost[NAMELEN + USERLEN + HOSTLEN + 6];
int use_althost = 0;
int i = 0;
hook_data_channel moduledata;
@ -964,8 +964,8 @@ find_bannickchange_channel(struct Client *client_p)
struct Channel *chptr;
struct membership *msptr;
rb_dlink_node *ptr;
char src_host[NICKLEN + USERLEN + HOSTLEN + 6];
char src_iphost[NICKLEN + USERLEN + HOSTLEN + 6];
char src_host[NAMELEN + USERLEN + HOSTLEN + 6];
char src_iphost[NAMELEN + USERLEN + HOSTLEN + 6];
if (!MyClient(client_p))
return NULL;

View file

@ -1261,7 +1261,7 @@ char *
get_oper_name(struct Client *client_p)
{
/* +5 for !,@,{,} and null */
static char buffer[NICKLEN + USERLEN + HOSTLEN + HOSTLEN + 5];
static char buffer[NAMELEN + USERLEN + HOSTLEN + HOSTLEN + 5];
if(MyOper(client_p))
{

View file

@ -414,13 +414,13 @@ register_local_user(struct Client *client_p, struct Client *source_p)
/* Apply nick override */
if(*source_p->preClient->spoofnick)
{
char note[NICKLEN + 10];
char note[NAMELEN + 10];
del_from_client_hash(source_p->name, source_p);
rb_strlcpy(source_p->name, source_p->preClient->spoofnick, NICKLEN + 1);
add_to_client_hash(source_p->name, source_p);
snprintf(note, NICKLEN + 10, "Nick: %s", source_p->name);
snprintf(note, sizeof(note), "Nick: %s", source_p->name);
rb_note(source_p->localClient->F, note);
}