Guard null callbacks in lfs_dir_fetchmatch

lfs_dir_fetch relies on an impossible tag match to avoid calling a
NULL callback. Add an explicit cb != NULL check in the match path
so future refactors don’t risk a NULL function-pointer call.
This commit is contained in:
Daimiao Chen
2026-01-22 11:04:59 -05:00
committed by Christopher Haster
parent adad0fbbcf
commit 2311cd785a
+1 -1
View File
@@ -1290,7 +1290,7 @@ static lfs_stag_t lfs_dir_fetchmatch(lfs_t *lfs,
}
// found a match for our fetcher?
if ((fmask & tag) == (fmask & ftag)) {
if ((fmask & tag) == (fmask & ftag) && (cb != NULL)) {
int res = cb(data, tag, &(struct lfs_diskoff){
dir->pair[0], off+sizeof(tag)});
if (res < 0) {