MAXPATHLEN -> PATH_MAX
Don't assume MAXHOSTNAMELEN includes the NUL Correct a diagnostic Use "localhost" in our prompt instead of ""
This commit is contained in:
parent
22dfb9bdb7
commit
5284761414
@ -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);
|
||||
|
@ -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)
|
||||
|
@ -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"};
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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';
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
};
|
||||
|
||||
|
@ -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 */
|
||||
|
@ -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];
|
||||
|
Loading…
x
Reference in New Issue
Block a user