mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2025-02-04 06:14:29 +03:00
Don't erase final byte of envblock
When we copy the envblock's contents out, we currently treat it as a normal C string. However, this functionality is supposed to more closely emulate interacting with a file. As a consequence, we were incorrectly truncating the contents of the envblock by replacing the final byte of the buffer with a null character. Reviewed-by: Pavel Zakharov <pavel.zakharov@delphix.com> Reviewed-by: Matthew Ahrens <mahrens@delphix.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Paul Dagnelie <pcd@delphix.com> Closes #10405
This commit is contained in:
parent
c9e319faae
commit
b2f3709c3e
@ -4539,7 +4539,7 @@ zpool_get_bootenv(zpool_handle_t *zhp, char *outbuf, size_t size, off_t offset)
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
strlcpy(outbuf, envmap + offset, size);
|
strncpy(outbuf, envmap + offset, size);
|
||||||
int bytes = MIN(strlen(envmap + offset), size);
|
int bytes = MIN(strlen(envmap + offset), size);
|
||||||
fnvlist_free(nvl);
|
fnvlist_free(nvl);
|
||||||
return (bytes);
|
return (bytes);
|
||||||
|
Loading…
Reference in New Issue
Block a user