diff options
author | Toomas Soome <tsoome@me.com> | 2019-01-26 17:22:39 +0200 |
---|---|---|
committer | Toomas Soome <tsoome@me.com> | 2019-08-06 18:34:52 +0300 |
commit | 6cb11604688f3d2bf2fb6d030c1f2bb3673a10d2 (patch) | |
tree | a1aa0e38f46171744b2a2e321339a682e4f06102 | |
parent | ae29b8adfe081d12042d2e5d0c843c6ad3842bd3 (diff) | |
download | illumos-joyent-6cb11604688f3d2bf2fb6d030c1f2bb3673a10d2.tar.gz |
11434 stmsboot: NULL pointer errors
11510 stmsboot: stmsboot_util -D option validation is broken
Reviewed by: Andy Fiddaman <andy@omniosce.org>
Reviewed by: John Levon <john.levon@joyent.com>
Reviewed by: Alexander Pyhalov <apyhalov@gmail.com>
Approved by: Dan McDonald <danmcd@joyent.com>
-rw-r--r-- | usr/src/cmd/stmsboot/stmsboot_util.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/usr/src/cmd/stmsboot/stmsboot_util.c b/usr/src/cmd/stmsboot/stmsboot_util.c index 5e04f37dbc..3293a25bc9 100644 --- a/usr/src/cmd/stmsboot/stmsboot_util.c +++ b/usr/src/cmd/stmsboot/stmsboot_util.c @@ -51,8 +51,8 @@ #define VHCI_CTL_NODE "/devices/scsi_vhci:devctl" /* nvlist property names, these are ALL string types */ -#define NVL_DEVID "nvl-devid" -#define NVL_PATH "nvl-path" +#define NVL_DEVID "nvl-devid" +#define NVL_PATH "nvl-path" #define NVL_PHYSPATH "nvl-physpath" #define NVL_MPXPATH "nvl-mpxiopath" #define NVL_MPXEN "nvl-mpxioenabled" @@ -409,12 +409,18 @@ parse_args(int argc, char *argv[]) "driver name: %s\n"), strerror(errno)); exit(errno); } - bcopy(optarg, drvlimit, strlen(optarg)); + if (strlcpy(drvlimit, optarg, MAXMODCONFNAME) >= + MAXMODCONFNAME) { + logmsg(MSG_ERROR, + gettext("invalid parent driver (%s) " + "specified"), optarg); + usage(); + } /* update this if adding support for a new driver */ - if ((strncmp(drvlimit, "fp", 2) == NULL) && - (strncmp(drvlimit, "mpt", 3) == NULL) && - (strncmp(drvlimit, "mpt_sas", 7) == NULL) && - (strncmp(drvlimit, "pmcs", 4) == NULL)) { + if (strcmp(drvlimit, "fp") != 0 && + strcmp(drvlimit, "mpt") != 0 && + strcmp(drvlimit, "mpt_sas") != 0 && + strcmp(drvlimit, "pmcs") != 0) { logmsg(MSG_ERROR, gettext("invalid parent driver (%s) " "specified"), drvlimit); |