mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2025-01-26 18:04:22 +03:00
Fix coverity defects: CID 147534
CID 147534: Negative array index read Reviewed-by: Giuseppe Di Natale <dinatale2@llnl.gov> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: cao.xuewen <cao.xuewen@zte.com.cn> Closes #5467
This commit is contained in:
parent
0101796290
commit
81eb8a1fbb
@ -2529,7 +2529,7 @@ userspace_cb(void *arg, const char *domain, uid_t rid, uint64_t space)
|
|||||||
namelen = strlen(name);
|
namelen = strlen(name);
|
||||||
}
|
}
|
||||||
nameidx = us_field_index("name");
|
nameidx = us_field_index("name");
|
||||||
if (namelen > cb->cb_width[nameidx])
|
if (nameidx >= 0 && namelen > cb->cb_width[nameidx])
|
||||||
cb->cb_width[nameidx] = namelen;
|
cb->cb_width[nameidx] = namelen;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2574,7 +2574,7 @@ userspace_cb(void *arg, const char *domain, uid_t rid, uint64_t space)
|
|||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
sizeidx = us_field_index(propname);
|
sizeidx = us_field_index(propname);
|
||||||
if (sizelen > cb->cb_width[sizeidx])
|
if (sizeidx >= 0 && sizelen > cb->cb_width[sizeidx])
|
||||||
cb->cb_width[sizeidx] = sizelen;
|
cb->cb_width[sizeidx] = sizelen;
|
||||||
|
|
||||||
if (nvlist_add_uint64(props, propname, space) != 0)
|
if (nvlist_add_uint64(props, propname, space) != 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user