From a5a19a33706a68a225e6df1ca627e654619f3a84 Mon Sep 17 00:00:00 2001 From: Solomon Peachy Date: Tue, 27 Oct 2020 21:57:40 -0400 Subject: dircache: Fix a NULL pointer dereference if idx == 0, get_idx_dcvolp() will return NULL. Change-Id: I4eafa71bb1f77ef8c865570bf8f124cdd9326d3e --- firmware/common/dircache.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'firmware/common/dircache.c') diff --git a/firmware/common/dircache.c b/firmware/common/dircache.c index 0cdaf1bd4a..589986911c 100644 --- a/firmware/common/dircache.c +++ b/firmware/common/dircache.c @@ -2612,7 +2612,8 @@ static dc_serial_t get_file_serialhash(const struct dircache_file *dcfilep) idx = ce->up; } - h = dc_hash_serialnum(get_idx_dcvolp(idx)->serialnum, h); + if (idx < 0) + h = dc_hash_serialnum(get_idx_dcvolp(idx)->serialnum, h); return h; } -- cgit v1.2.3