diff options
author | cao <[email protected]> | 2016-10-15 02:00:47 +0800 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2016-10-14 11:00:47 -0700 |
commit | b6ca6193f7678a9d8790f4319c982cc34b59f150 (patch) | |
tree | 723fea856a781f217ecc5e4389b9bcedd1c34856 /lib | |
parent | 3691598e26a878df792480e0a97ea5c2bf012e49 (diff) |
Fix coverity defects: CID 147488, 147490
CID 147488, Type:explicit null dereferenced
CID 147490, Type:dereference null return value
Reviewed-by: Giuseppe Di Natale <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: cao.xuewen <[email protected]>
Closes #5237
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libzfs/libzfs_util.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/libzfs/libzfs_util.c b/lib/libzfs/libzfs_util.c index 2f29027c9..ca32e7a7f 100644 --- a/lib/libzfs/libzfs_util.c +++ b/lib/libzfs/libzfs_util.c @@ -1585,6 +1585,7 @@ zprop_parse_value(libzfs_handle_t *hdl, nvpair_t *elem, int prop, const char *propname; char *value; boolean_t isnone = B_FALSE; + int err = 0; if (type == ZFS_TYPE_POOL) { proptype = zpool_prop_get_type(prop); @@ -1607,7 +1608,12 @@ zprop_parse_value(libzfs_handle_t *hdl, nvpair_t *elem, int prop, "'%s' must be a string"), nvpair_name(elem)); goto error; } - (void) nvpair_value_string(elem, svalp); + err = nvpair_value_string(elem, svalp); + if (err != 0) { + zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, + "'%s' is invalid"), nvpair_name(elem)); + goto error; + } if (strlen(*svalp) >= ZFS_MAXPROPLEN) { zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, "'%s' is too long"), nvpair_name(elem)); |