From 26e6a622c0e2bfcb1a69c75fa949d7d52df2e46f Mon Sep 17 00:00:00 2001 From: Brian Somers Date: Fri, 9 Mar 2001 20:31:02 +0000 Subject: [PATCH] MAXHOSTNAME includes space for a NUL --- usr.sbin/ppp/ip.c | 12 ++++++------ usr.sbin/ppp/ipcp.c | 2 +- usr.sbin/ppp/prompt.c | 2 +- usr.sbin/ppp/radius.c | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/usr.sbin/ppp/ip.c b/usr.sbin/ppp/ip.c index fa265bb234d..34aa1c2a504 100644 --- a/usr.sbin/ppp/ip.c +++ b/usr.sbin/ppp/ip.c @@ -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); } } diff --git a/usr.sbin/ppp/ipcp.c b/usr.sbin/ppp/ipcp.c index b10657ab4d9..6369a48d613 100644 --- a/usr.sbin/ppp/ipcp.c +++ b/usr.sbin/ppp/ipcp.c @@ -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"}; diff --git a/usr.sbin/ppp/prompt.c b/usr.sbin/ppp/prompt.c index 0aafbe33ddb..1362ee6d7c1 100644 --- a/usr.sbin/ppp/prompt.c +++ b/usr.sbin/ppp/prompt.c @@ -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) diff --git a/usr.sbin/ppp/radius.c b/usr.sbin/ppp/radius.c index b031a520791..79c81b01a71 100644 --- a/usr.sbin/ppp/radius.c +++ b/usr.sbin/ppp/radius.c @@ -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;