瀏覽代碼

fix: add missing return causing uninitialized reads

If lfs_bd_read fails, lfs_fcrc_fromle32 will read uninitialized memory, and hasfcrc will be set to true.

This may end up in a "working" state later due to crcs not matching. but it's hard to follow if that woud be the case.
Joakim Plate 4 月之前
父節點
當前提交
8b75de74c9
共有 1 個文件被更改,包括 1 次插入0 次删除
  1. 1 0
      lfs.c

+ 1 - 0
lfs.c

@@ -1279,6 +1279,7 @@ static lfs_stag_t lfs_dir_fetchmatch(lfs_t *lfs,
                     if (err == LFS_ERR_CORRUPT) {
                         break;
                     }
+                    return err;
                 }
 
                 lfs_fcrc_fromle32(&fcrc);