diff options
author | brian <brian@FreeBSD.org> | 2001-03-08 23:51:50 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 2001-03-08 23:51:50 +0000 |
commit | 298eccdc148d36583de336afa8746580f3a33aff (patch) | |
tree | 4930fa9219854ec1b2631e7ff7770d40461aee98 | |
parent | 4010cd1c76927246d32483cd92a0c8cb0c42a159 (diff) | |
download | FreeBSD-src-298eccdc148d36583de336afa8746580f3a33aff.zip FreeBSD-src-298eccdc148d36583de336afa8746580f3a33aff.tar.gz |
MAXPATHLEN -> PATH_MAX
Don't assume MAXHOSTNAMELEN includes the NUL
Correct a diagnostic
Use "localhost" in our prompt instead of ""
-rw-r--r-- | usr.sbin/ppp/bundle.c | 4 | ||||
-rw-r--r-- | usr.sbin/ppp/ip.c | 4 | ||||
-rw-r--r-- | usr.sbin/ppp/ipcp.c | 2 | ||||
-rw-r--r-- | usr.sbin/ppp/physical.c | 8 | ||||
-rw-r--r-- | usr.sbin/ppp/prompt.c | 4 | ||||
-rw-r--r-- | usr.sbin/ppp/radius.c | 4 | ||||
-rw-r--r-- | usr.sbin/ppp/radius.h | 2 | ||||
-rw-r--r-- | usr.sbin/ppp/server.h | 2 | ||||
-rw-r--r-- | usr.sbin/ppp/systems.c | 2 |
9 files changed, 16 insertions, 16 deletions
diff --git a/usr.sbin/ppp/bundle.c b/usr.sbin/ppp/bundle.c index 083c474..1769b9f 100644 --- a/usr.sbin/ppp/bundle.c +++ b/usr.sbin/ppp/bundle.c @@ -645,7 +645,7 @@ void bundle_LockTun(struct bundle *bundle) { FILE *lockfile; - char pidfile[MAXPATHLEN]; + char pidfile[PATH_MAX]; snprintf(pidfile, sizeof pidfile, "%stun%d.pid", _PATH_VARRUN, bundle->unit); lockfile = ID0fopen(pidfile, "w"); @@ -663,7 +663,7 @@ bundle_LockTun(struct bundle *bundle) static void bundle_UnlockTun(struct bundle *bundle) { - char pidfile[MAXPATHLEN]; + char pidfile[PATH_MAX]; snprintf(pidfile, sizeof pidfile, "%stun%d.pid", _PATH_VARRUN, bundle->unit); ID0unlink(pidfile); diff --git a/usr.sbin/ppp/ip.c b/usr.sbin/ppp/ip.c index 2d9158c..fa265bb 100644 --- a/usr.sbin/ppp/ip.c +++ b/usr.sbin/ppp/ip.c @@ -471,8 +471,8 @@ ip_LogDNS(const struct udphdr *uh, const char *direction) n = name; end = ptr + len - 4; - if (end - ptr > MAXHOSTNAMELEN) - end = ptr + MAXHOSTNAMELEN; + if (end - ptr >= sizeof name) + end = ptr + sizeof name - 1; while (ptr < end) { len = *ptr++; if (len > end - ptr) diff --git a/usr.sbin/ppp/ipcp.c b/usr.sbin/ppp/ipcp.c index 6369a48..b10657a 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]; + char name[MAXHOSTNAMELEN + 1]; static const char * const timer_names[] = {"IPCP restart", "IPCP openmode", "IPCP stopped"}; diff --git a/usr.sbin/ppp/physical.c b/usr.sbin/ppp/physical.c index 5e50224..e426890 100644 --- a/usr.sbin/ppp/physical.c +++ b/usr.sbin/ppp/physical.c @@ -321,17 +321,17 @@ physical_Lock(struct physical *p) static void physical_Unlock(struct physical *p) { - char fn[MAXPATHLEN]; if (*p->name.full == '/' && p->type != PHYS_DIRECT && ID0uu_unlock(p->name.base) == -1) - log_Printf(LogALERT, "%s: Can't uu_unlock %s\n", p->link.name, fn); + log_Printf(LogALERT, "%s: Can't uu_unlock %s\n", p->link.name, + p->name.base); } void physical_Close(struct physical *p) { int newsid; - char fn[MAXPATHLEN]; + char fn[PATH_MAX]; if (p->fd < 0) return; @@ -957,7 +957,7 @@ static void physical_Found(struct physical *p) { FILE *lockfile; - char fn[MAXPATHLEN]; + char fn[PATH_MAX]; if (*p->name.full == '/') { snprintf(fn, sizeof fn, "%s%s.if", _PATH_VARRUN, p->name.base); diff --git a/usr.sbin/ppp/prompt.c b/usr.sbin/ppp/prompt.c index 46fb9ee..0aafbe3 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]; + static char shostname[MAXHOSTNAMELEN + 1]; const char *pconnect, *pauth; if (p->TermMode || !p->needprompt) @@ -109,7 +109,7 @@ prompt_Display(struct prompt *p) if (*shostname == '\0') { char *dot; - if (gethostname(shostname, sizeof shostname)) + if (gethostname(shostname, sizeof shostname) || *shostname == '\0') strcpy(shostname, "localhost"); else if ((dot = strchr(shostname, '.'))) *dot = '\0'; diff --git a/usr.sbin/ppp/radius.c b/usr.sbin/ppp/radius.c index 79c81b0..b031a52 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]; + char hostname[MAXHOSTNAMELEN + 1]; 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]; + char hostname[MAXHOSTNAMELEN + 1]; struct hostent *hp; struct in_addr hostaddr; diff --git a/usr.sbin/ppp/radius.h b/usr.sbin/ppp/radius.h index 393b1d2..a02847c 100644 --- a/usr.sbin/ppp/radius.h +++ b/usr.sbin/ppp/radius.h @@ -41,7 +41,7 @@ struct radius { unsigned long mtu; /* FRAMED MTU */ struct sticky_route *routes; /* FRAMED Routes */ struct { - char file[MAXPATHLEN]; /* Radius config file */ + char file[PATH_MAX]; /* Radius config file */ } cfg; }; diff --git a/usr.sbin/ppp/server.h b/usr.sbin/ppp/server.h index 805c438..9fdc52c 100644 --- a/usr.sbin/ppp/server.h +++ b/usr.sbin/ppp/server.h @@ -35,7 +35,7 @@ struct server { struct { char passwd[50]; - char sockname[MAXPATHLEN]; /* Points to local socket path */ + char sockname[PATH_MAX]; /* Points to local socket path */ mode_t mask; u_short port; /* tcp socket */ diff --git a/usr.sbin/ppp/systems.c b/usr.sbin/ppp/systems.c index 90e1183..1b45853 100644 --- a/usr.sbin/ppp/systems.c +++ b/usr.sbin/ppp/systems.c @@ -313,7 +313,7 @@ ReadSystem(struct bundle *bundle, const char *name, const char *file, char *cp; int n, len; char line[LINE_LEN]; - char filename[MAXPATHLEN]; + char filename[PATH_MAX]; int linenum; int argc; char *argv[MAXARGS]; |