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:
parent
30053ab982
commit
fe5fc851aa
8 changed files with 24 additions and 22 deletions
|
@ -32,10 +32,10 @@ _moddeinit(void)
|
||||||
static int
|
static int
|
||||||
eb_hostmask(const char *banstr, struct Client *client_p, struct Channel *chptr, long mode_type)
|
eb_hostmask(const char *banstr, struct Client *client_p, struct Channel *chptr, long mode_type)
|
||||||
{
|
{
|
||||||
char src_host[NICKLEN + USERLEN + HOSTLEN + 6];
|
char src_host[NAMELEN + USERLEN + HOSTLEN + 6];
|
||||||
char src_iphost[NICKLEN + USERLEN + HOSTLEN + 6];
|
char src_iphost[NAMELEN + USERLEN + HOSTLEN + 6];
|
||||||
char src_althost[NICKLEN + USERLEN + HOSTLEN + 6];
|
char src_althost[NAMELEN + USERLEN + HOSTLEN + 6];
|
||||||
char src_ip4host[NICKLEN + USERLEN + HOSTLEN + 6];
|
char src_ip4host[NAMELEN + USERLEN + HOSTLEN + 6];
|
||||||
struct sockaddr_in ip4;
|
struct sockaddr_in ip4;
|
||||||
char *s = src_host, *s2 = src_iphost, *s3 = NULL, *s4 = NULL;
|
char *s = src_host, *s2 = src_iphost, *s3 = NULL, *s4 = NULL;
|
||||||
|
|
||||||
|
|
|
@ -126,7 +126,7 @@ struct Client
|
||||||
unsigned long serial; /* used to enforce 1 send per nick */
|
unsigned long serial; /* used to enforce 1 send per nick */
|
||||||
|
|
||||||
/* client->name is the unique name for a client nick or host */
|
/* client->name is the unique name for a client nick or host */
|
||||||
char name[HOSTLEN + 1];
|
char name[NAMELEN + 1];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* client->username is the username from ident or the USER message,
|
* client->username is the username from ident or the USER message,
|
||||||
|
|
|
@ -97,7 +97,9 @@
|
||||||
#define EXT_BUFSIZE (TAGSLEN + DATALEN + 1)
|
#define EXT_BUFSIZE (TAGSLEN + DATALEN + 1)
|
||||||
#define OPERNICKLEN (NICKLEN*2) /* Length of OPERNICKs. */
|
#define OPERNICKLEN (NICKLEN*2) /* Length of OPERNICKs. */
|
||||||
|
|
||||||
#define USERHOST_REPLYLEN (NICKLEN+HOSTLEN+USERLEN+5)
|
#define NAMELEN (MAX(NICKLEN, HOSTLEN))
|
||||||
|
|
||||||
|
#define USERHOST_REPLYLEN (NAMELEN+HOSTLEN+USERLEN+5)
|
||||||
#define MAX_DATE_STRING 32 /* maximum string length for a date string */
|
#define MAX_DATE_STRING 32 /* maximum string length for a date string */
|
||||||
|
|
||||||
#define HELPLEN 400
|
#define HELPLEN 400
|
||||||
|
|
|
@ -539,10 +539,10 @@ is_banned_list(struct Channel *chptr, rb_dlink_list *list,
|
||||||
struct Client *who, struct membership *msptr,
|
struct Client *who, struct membership *msptr,
|
||||||
const char *s, const char *s2, const char **forward)
|
const char *s, const char *s2, const char **forward)
|
||||||
{
|
{
|
||||||
char src_host[NICKLEN + USERLEN + HOSTLEN + 6];
|
char src_host[NAMELEN + USERLEN + HOSTLEN + 6];
|
||||||
char src_iphost[NICKLEN + USERLEN + HOSTLEN + 6];
|
char src_iphost[NAMELEN + USERLEN + HOSTLEN + 6];
|
||||||
char src_althost[NICKLEN + USERLEN + HOSTLEN + 6];
|
char src_althost[NAMELEN + USERLEN + HOSTLEN + 6];
|
||||||
char src_ip4host[NICKLEN + USERLEN + HOSTLEN + 6];
|
char src_ip4host[NAMELEN + USERLEN + HOSTLEN + 6];
|
||||||
char *s3 = NULL;
|
char *s3 = NULL;
|
||||||
char *s4 = NULL;
|
char *s4 = NULL;
|
||||||
struct sockaddr_in ip4;
|
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 *invite = NULL;
|
||||||
rb_dlink_node *ptr;
|
rb_dlink_node *ptr;
|
||||||
struct Ban *invex = NULL;
|
struct Ban *invex = NULL;
|
||||||
char src_host[NICKLEN + USERLEN + HOSTLEN + 6];
|
char src_host[NAMELEN + USERLEN + HOSTLEN + 6];
|
||||||
char src_iphost[NICKLEN + USERLEN + HOSTLEN + 6];
|
char src_iphost[NAMELEN + USERLEN + HOSTLEN + 6];
|
||||||
char src_althost[NICKLEN + USERLEN + HOSTLEN + 6];
|
char src_althost[NAMELEN + USERLEN + HOSTLEN + 6];
|
||||||
int use_althost = 0;
|
int use_althost = 0;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
hook_data_channel moduledata;
|
hook_data_channel moduledata;
|
||||||
|
@ -964,8 +964,8 @@ find_bannickchange_channel(struct Client *client_p)
|
||||||
struct Channel *chptr;
|
struct Channel *chptr;
|
||||||
struct membership *msptr;
|
struct membership *msptr;
|
||||||
rb_dlink_node *ptr;
|
rb_dlink_node *ptr;
|
||||||
char src_host[NICKLEN + USERLEN + HOSTLEN + 6];
|
char src_host[NAMELEN + USERLEN + HOSTLEN + 6];
|
||||||
char src_iphost[NICKLEN + USERLEN + HOSTLEN + 6];
|
char src_iphost[NAMELEN + USERLEN + HOSTLEN + 6];
|
||||||
|
|
||||||
if (!MyClient(client_p))
|
if (!MyClient(client_p))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -1261,7 +1261,7 @@ char *
|
||||||
get_oper_name(struct Client *client_p)
|
get_oper_name(struct Client *client_p)
|
||||||
{
|
{
|
||||||
/* +5 for !,@,{,} and null */
|
/* +5 for !,@,{,} and null */
|
||||||
static char buffer[NICKLEN + USERLEN + HOSTLEN + HOSTLEN + 5];
|
static char buffer[NAMELEN + USERLEN + HOSTLEN + HOSTLEN + 5];
|
||||||
|
|
||||||
if(MyOper(client_p))
|
if(MyOper(client_p))
|
||||||
{
|
{
|
||||||
|
|
|
@ -414,13 +414,13 @@ register_local_user(struct Client *client_p, struct Client *source_p)
|
||||||
/* Apply nick override */
|
/* Apply nick override */
|
||||||
if(*source_p->preClient->spoofnick)
|
if(*source_p->preClient->spoofnick)
|
||||||
{
|
{
|
||||||
char note[NICKLEN + 10];
|
char note[NAMELEN + 10];
|
||||||
|
|
||||||
del_from_client_hash(source_p->name, source_p);
|
del_from_client_hash(source_p->name, source_p);
|
||||||
rb_strlcpy(source_p->name, source_p->preClient->spoofnick, NICKLEN + 1);
|
rb_strlcpy(source_p->name, source_p->preClient->spoofnick, NICKLEN + 1);
|
||||||
add_to_client_hash(source_p->name, source_p);
|
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);
|
rb_note(source_p->localClient->F, note);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -160,7 +160,7 @@ me_rsfnc(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
|
||||||
struct Client *target_p;
|
struct Client *target_p;
|
||||||
struct Client *exist_p;
|
struct Client *exist_p;
|
||||||
time_t newts, curts;
|
time_t newts, curts;
|
||||||
char note[NICKLEN + 10];
|
char note[NAMELEN + 10];
|
||||||
|
|
||||||
if(!(source_p->flags & FLAGS_SERVICE))
|
if(!(source_p->flags & FLAGS_SERVICE))
|
||||||
{
|
{
|
||||||
|
@ -252,7 +252,7 @@ doit:
|
||||||
|
|
||||||
del_all_accepts(target_p);
|
del_all_accepts(target_p);
|
||||||
|
|
||||||
snprintf(note, NICKLEN + 10, "Nick: %s", target_p->name);
|
snprintf(note, sizeof(note), "Nick: %s", target_p->name);
|
||||||
rb_note(target_p->localClient->F, note);
|
rb_note(target_p->localClient->F, note);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -233,11 +233,11 @@ me_svslogin(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sou
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char note[NICKLEN + 10];
|
char note[NAMELEN + 10];
|
||||||
|
|
||||||
send_signon(NULL, target_p, nick, user, host, rb_current_time(), login);
|
send_signon(NULL, target_p, nick, user, host, rb_current_time(), login);
|
||||||
|
|
||||||
snprintf(note, NICKLEN + 10, "Nick: %s", target_p->name);
|
snprintf(note, sizeof(note), "Nick: %s", target_p->name);
|
||||||
rb_note(target_p->localClient->F, note);
|
rb_note(target_p->localClient->F, note);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue