summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authorjwd <jwd@FreeBSD.org>2003-02-27 03:57:17 +0000
committerjwd <jwd@FreeBSD.org>2003-02-27 03:57:17 +0000
commit1269b76675254ee22c7e0935d89bb251c990cfc0 (patch)
tree3e196a13512839af251c9d1e74476c61a20df87c /usr.sbin
parentd2eb4692a27e5b54b560eab35d2d7fef786d129f (diff)
downloadFreeBSD-src-1269b76675254ee22c7e0935d89bb251c990cfc0.zip
FreeBSD-src-1269b76675254ee22c7e0935d89bb251c990cfc0.tar.gz
- Increase the maximum device name length.
- Actually check that the entered device name does not exceed the maximum device name length. PR: misc/18466 MFC after: 2 weeks
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/sade/sade.h2
-rw-r--r--usr.sbin/sysinstall/media.c17
-rw-r--r--usr.sbin/sysinstall/sysinstall.h2
3 files changed, 18 insertions, 3 deletions
diff --git a/usr.sbin/sade/sade.h b/usr.sbin/sade/sade.h
index 68a16c9..60a6590 100644
--- a/usr.sbin/sade/sade.h
+++ b/usr.sbin/sade/sade.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 */
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 */
OpenPOWER on IntegriCloud