Skip to content

Commit

Permalink
Fix get_special_prop() build failure
Browse files Browse the repository at this point in the history
The cast of the size_t returned by strlcpy() to a uint64_t by the
VERIFY3U can result in a build failure when CONFIG_FORTIFY_SOURCE
is set.  This is due to the additional hardening.  Since the token
is expected to always fit in strval the VERIFY3U has been removed.
If somehow it doesn't, it will still be safely truncated.

Reviewed-by: Tony Hutter <[email protected]>
Reviewed-by: Don Brady <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Issue #8999
Closes #9020
behlendorf authored Jul 16, 2019

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent d45d7f0 commit 3b03ff2
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions module/zfs/zcp_get.c
Original file line number Diff line number Diff line change
@@ -423,13 +423,11 @@ get_special_prop(lua_State *state, dsl_dataset_t *ds, const char *dsname,
case ZFS_PROP_RECEIVE_RESUME_TOKEN: {
char *token = get_receive_resume_stats_impl(ds);

VERIFY3U(strlcpy(strval, token, ZAP_MAXVALUELEN),
<, ZAP_MAXVALUELEN);
(void) strlcpy(strval, token, ZAP_MAXVALUELEN);
if (strcmp(strval, "") == 0) {
char *childval = get_child_receive_stats(ds);

VERIFY3U(strlcpy(strval, childval, ZAP_MAXVALUELEN),
<, ZAP_MAXVALUELEN);
(void) strlcpy(strval, childval, ZAP_MAXVALUELEN);
if (strcmp(strval, "") == 0)
error = ENOENT;

0 comments on commit 3b03ff2

Please sign in to comment.