From: Daniel P. Berrangé <[email protected]> We've already checked the upper bound of the array, but we should none the less sanity check that the requested array element is not NULL before dereferencing it.
Signed-off-by: Daniel P. Berrangé <[email protected]> --- tools/nss/libvirt_nss_macs.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/nss/libvirt_nss_macs.c b/tools/nss/libvirt_nss_macs.c index 44544624f3..1110848060 100644 --- a/tools/nss/libvirt_nss_macs.c +++ b/tools/nss/libvirt_nss_macs.c @@ -101,6 +101,8 @@ findMACsFromJSON(json_object *jobj, char *macstr; macobj = json_object_array_get_idx(macsArray, j); + if (!macobj) + return -1; macstr = strdup(json_object_get_string(macobj)); if (!macstr) return -1; -- 2.51.1
