summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2020-10-27 21:57:40 -0400
committerSolomon Peachy <pizza@shaftnet.org>2020-10-27 21:57:40 -0400
commita5a19a33706a68a225e6df1ca627e654619f3a84 (patch)
tree3520ae144af016dcf4ee9b888c937fdd845ef296 /firmware
parent7dbfda6c55696eb7ba675e8548fe375a21d5d13b (diff)
downloadrockbox-a5a19a33706a68a225e6df1ca627e654619f3a84.tar.gz
rockbox-a5a19a33706a68a225e6df1ca627e654619f3a84.zip
dircache: Fix a NULL pointer dereference
if idx == 0, get_idx_dcvolp() will return NULL. Change-Id: I4eafa71bb1f77ef8c865570bf8f124cdd9326d3e
Diffstat (limited to 'firmware')
-rw-r--r--firmware/common/dircache.c3
1 files changed, 2 insertions, 1 deletions
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)
2612 idx = ce->up; 2612 idx = ce->up;
2613 } 2613 }
2614 2614
2615 h = dc_hash_serialnum(get_idx_dcvolp(idx)->serialnum, h); 2615 if (idx < 0)
2616 h = dc_hash_serialnum(get_idx_dcvolp(idx)->serialnum, h);
2616 2617
2617 return h; 2618 return h;
2618} 2619}