diff options
author | Tony Hutter <[email protected]> | 2017-06-28 10:05:16 -0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2017-06-28 10:05:16 -0700 |
commit | 682ce104cdd80db4b67eea09eb0a90324c5f98ee (patch) | |
tree | 3fa2067633f5c089685600f25601af0f791bfcaf /lib/libzfs/libzfs_iter.c | |
parent | cda0317e4d2a1277b328e4fc42ee3699bbe46c12 (diff) |
GCC 7.1 fixes
GCC 7.1 with will warn when we're not checking the snprintf()
return code in cases where the buffer could be truncated. This
patch either checks the snprintf return code (where applicable),
or simply disables the warnings (ztest.c).
Reviewed-by: Chunwei Chen <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Tony Hutter <[email protected]>
Closes #6253
Diffstat (limited to 'lib/libzfs/libzfs_iter.c')
-rw-r--r-- | lib/libzfs/libzfs_iter.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/libzfs/libzfs_iter.c b/lib/libzfs/libzfs_iter.c index d78c757a5..57ebdd89d 100644 --- a/lib/libzfs/libzfs_iter.c +++ b/lib/libzfs/libzfs_iter.c @@ -204,8 +204,11 @@ zfs_iter_bookmarks(zfs_handle_t *zhp, zfs_iter_f func, void *data) bmark_name = nvpair_name(pair); bmark_props = fnvpair_value_nvlist(pair); - (void) snprintf(name, sizeof (name), "%s#%s", zhp->zfs_name, - bmark_name); + if (snprintf(name, sizeof (name), "%s#%s", zhp->zfs_name, + bmark_name) >= sizeof (name)) { + err = EINVAL; + goto out; + } nzhp = make_bookmark_handle(zhp, name, bmark_props); if (nzhp == NULL) |