mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-14 22:32:30 +01:00
When we have a command returned by zfs_nextboot() that is longer
than command in the loader.conf, the latter needs to be nul terminated, otherwise garbage trailer left from zfs_nextboot() will be passed to parse_cmd() together with loader.conf command. While here, reset cmd to empty string if read() returns error. Reviewed by: tsoome
This commit is contained in:
parent
e627909d04
commit
c7dd069c70
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=364441
@ -248,7 +248,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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user