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:
committed by
Christopher Haster
parent
adad0fbbcf
commit
2311cd785a
@@ -1290,7 +1290,7 @@ static lfs_stag_t lfs_dir_fetchmatch(lfs_t *lfs,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// found a match for our fetcher?
|
// 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){
|
int res = cb(data, tag, &(struct lfs_diskoff){
|
||||||
dir->pair[0], off+sizeof(tag)});
|
dir->pair[0], off+sizeof(tag)});
|
||||||
if (res < 0) {
|
if (res < 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user