MAXHOSTNAME includes space for a NUL

This commit is contained in:
Brian Somers 2001-03-09 20:31:02 +00:00
parent a3e862d902
commit 26e6a622c0
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=74049
4 changed files with 10 additions and 10 deletions

View File

@ -465,19 +465,19 @@ ip_LogDNS(const struct udphdr *uh, const char *direction)
if (header.opcode == OPCODE_QUERY && header.qr == 0) {
/* rfc1035 */
char name[MAXHOSTNAMELEN + 1], *n;
char namewithdot[MAXHOSTNAMELEN + 1], *n;
const char *qtype, *qclass;
const u_char *end;
n = name;
n = namewithdot;
end = ptr + len - 4;
if (end - ptr >= sizeof name)
end = ptr + sizeof name - 1;
if (end - ptr >= sizeof namewithdot)
end = ptr + sizeof namewithdot - 1;
while (ptr < end) {
len = *ptr++;
if (len > end - ptr)
len = end - ptr;
if (n != name)
if (n != namewithdot)
*n++ = '.';
memcpy(n, ptr, len);
ptr += len;
@ -488,7 +488,7 @@ ip_LogDNS(const struct udphdr *uh, const char *direction)
qclass = dns_Qclass2Txt(ntohs(*(const u_short *)(end + 2)));
log_Printf(LogDNS, "%sbound query %s %s %s\n",
direction, qclass, qtype, name);
direction, qclass, qtype, namewithdot);
}
}

View File

@ -541,7 +541,7 @@ ipcp_Init(struct ipcp *ipcp, struct bundle *bundle, struct link *l,
const struct fsm_parent *parent)
{
struct hostent *hp;
char name[MAXHOSTNAMELEN + 1];
char name[MAXHOSTNAMELEN];
static const char * const timer_names[] =
{"IPCP restart", "IPCP openmode", "IPCP stopped"};

View File

@ -79,7 +79,7 @@ static void
prompt_Display(struct prompt *p)
{
/* XXX: See Index2Nam() - should we only figure this out once ? */
static char shostname[MAXHOSTNAMELEN + 1];
static char shostname[MAXHOSTNAMELEN];
const char *pconnect, *pauth;
if (p->TermMode || !p->needprompt)

View File

@ -373,7 +373,7 @@ radius_Authenticate(struct radius *r, struct authinfo *authp, const char *name,
struct ttyent *ttyp;
struct timeval tv;
int got, slot;
char hostname[MAXHOSTNAMELEN + 1];
char hostname[MAXHOSTNAMELEN];
struct hostent *hp;
struct in_addr hostaddr;
@ -493,7 +493,7 @@ radius_Account(struct radius *r, struct radacct *ac, struct datalink *dl,
struct ttyent *ttyp;
struct timeval tv;
int got, slot;
char hostname[MAXHOSTNAMELEN + 1];
char hostname[MAXHOSTNAMELEN];
struct hostent *hp;
struct in_addr hostaddr;