summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToomas Soome <tsoome@me.com>2020-08-21 00:04:30 +0300
committerToomas Soome <tsoome@me.com>2020-08-21 21:01:52 +0300
commitb89fb824168e36795c325b5e0a4d1e71dd2d8d65 (patch)
treec9f03d02f0c1c131974cda6cbfffe2213df25aad
parent8548ec78d85644539a23c4262ed2b9512a47865e (diff)
downloadillumos-joyent-b89fb824168e36795c325b5e0a4d1e71dd2d8d65.tar.gz
13068 gptzfsboot: command from /boot/config should be nul terminated
Reviewed by: Andy Fiddaman <andy@omniosce.org> Reviewed by: Juraj Lutter <juraj@lutter.sk> Approved by: Robert Mustacchi <rm@fingolfin.org>
-rw-r--r--usr/src/boot/Makefile.version2
-rw-r--r--usr/src/boot/sys/boot/i386/gptzfsboot/zfsboot.c7
2 files changed, 7 insertions, 2 deletions
diff --git a/usr/src/boot/Makefile.version b/usr/src/boot/Makefile.version
index 5d93ec0e76..bf217cddfd 100644
--- a/usr/src/boot/Makefile.version
+++ b/usr/src/boot/Makefile.version
@@ -33,4 +33,4 @@ LOADER_VERSION = 1.1
# Use date like formatting here, YYYY.MM.DD.XX, without leading zeroes.
# The version is processed from left to right, the version number can only
# be increased.
-BOOT_VERSION = $(LOADER_VERSION)-2020.08.05.1
+BOOT_VERSION = $(LOADER_VERSION)-2020.08.21.1
diff --git a/usr/src/boot/sys/boot/i386/gptzfsboot/zfsboot.c b/usr/src/boot/sys/boot/i386/gptzfsboot/zfsboot.c
index 872ad3d3bc..63ba02968a 100644
--- a/usr/src/boot/sys/boot/i386/gptzfsboot/zfsboot.c
+++ b/usr/src/boot/sys/boot/i386/gptzfsboot/zfsboot.c
@@ -205,7 +205,12 @@ main(void)
fd = open(PATH_DOTCONFIG, O_RDONLY);
if (fd != -1) {
- read(fd, cmd, sizeof (cmd));
+ ssize_t cmdlen;
+
+ if ((cmdlen = read(fd, cmd, sizeof (cmd))) > 0)
+ cmd[cmdlen] = '\0';
+ else
+ *cmd = '\0';
close(fd);
}