diff options
author | Paul Dagnelie <[email protected]> | 2020-06-08 08:58:13 -0700 |
---|---|---|
committer | GitHub <[email protected]> | 2020-06-08 08:58:13 -0700 |
commit | b2f3709c3ec0116773c9269431dc8f9f97563028 (patch) | |
tree | c9176256d2f088f5f7bf023edaa13df1e5948eb2 /lib | |
parent | c9e319faae9677aa0dddfbf9973b9e8fc3feb06c (diff) |
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 <[email protected]>
Reviewed-by: Matthew Ahrens <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Paul Dagnelie <[email protected]>
Closes #10405
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libzfs/libzfs_pool.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/libzfs/libzfs_pool.c b/lib/libzfs/libzfs_pool.c index 6123020f7..96ac42622 100644 --- a/lib/libzfs/libzfs_pool.c +++ b/lib/libzfs/libzfs_pool.c @@ -4539,7 +4539,7 @@ zpool_get_bootenv(zpool_handle_t *zhp, char *outbuf, size_t size, off_t offset) return (0); } - strlcpy(outbuf, envmap + offset, size); + strncpy(outbuf, envmap + offset, size); int bytes = MIN(strlen(envmap + offset), size); fnvlist_free(nvl); return (bytes); |