diff options
Diffstat (limited to 'usr.sbin/sysinstall')
-rw-r--r-- | usr.sbin/sysinstall/media.c | 17 | ||||
-rw-r--r-- | usr.sbin/sysinstall/sysinstall.h | 2 |
2 files changed, 17 insertions, 2 deletions
diff --git a/usr.sbin/sysinstall/media.c b/usr.sbin/sysinstall/media.c index 681a584..cbdc01c 100644 --- a/usr.sbin/sysinstall/media.c +++ b/usr.sbin/sysinstall/media.c @@ -317,7 +317,7 @@ mediaSetFTP(dialogMenuItem *self) static Device ftpDevice; char *cp, hbuf[MAXHOSTNAMELEN], *hostname, *dir; struct addrinfo hints, *res; - int af; + int af, urllen; extern int FtpPort; static Device *networkDev = NULL; @@ -347,6 +347,13 @@ mediaSetFTP(dialogMenuItem *self) variable_unset(VAR_FTP_PATH); return DITEM_FAILURE; } + urllen = strlen(cp); + if (urllen >= sizeof(ftpDevice.name)) { + msgConfirm("Length of specified URL is %d characters. Allowable maximum is %d.", + urllen,sizeof(ftpDevice.name)-1); + variable_unset(VAR_FTP_PATH); + return DITEM_FAILURE; + } } if (strncmp("ftp://", cp, 6)) { msgConfirm("Sorry, %s is an invalid URL!", cp); @@ -539,6 +546,7 @@ mediaSetNFS(dialogMenuItem *self) static Device *networkDev = NULL; char *cp, *idx; char hostname[MAXPATHLEN]; + int pathlen; mediaClose(); cp = variable_get_value(VAR_NFS_PATH, "Please enter the full NFS file specification for the remote\n" @@ -552,6 +560,13 @@ mediaSetNFS(dialogMenuItem *self) "host:/full/pathname/to/FreeBSD/distdir"); return DITEM_FAILURE; } + pathlen = strlen(hostname); + if (pathlen >= sizeof(nfsDevice.name)) { + msgConfirm("Length of specified NFS path is %d characters. Allowable maximum is %d.", + pathlen,sizeof(nfsDevice.name)-1); + variable_unset(VAR_NFS_PATH); + return DITEM_FAILURE; + } SAFE_STRCPY(nfsDevice.name, hostname); *idx = '\0'; if (!networkDev || msgYesNo("You've already done the network configuration once,\n" diff --git a/usr.sbin/sysinstall/sysinstall.h b/usr.sbin/sysinstall/sysinstall.h index 68a16c9..60a6590 100644 --- a/usr.sbin/sysinstall/sysinstall.h +++ b/usr.sbin/sysinstall/sysinstall.h @@ -72,7 +72,7 @@ #endif /* device limits */ -#define DEV_NAME_MAX 64 /* The maximum length of a device name */ +#define DEV_NAME_MAX 128 /* The maximum length of a device name */ #define DEV_MAX 100 /* The maximum number of devices we'll deal with */ #define INTERFACE_MAX 50 /* Maximum number of network interfaces we'll deal with */ #define IO_ERROR -2 /* Status code for I/O error rather than normal EOF */ |