浏览代码

Fixed buffer overflow due to mistaking prog_size for cache_size

found by ajaybhargav
Christopher Haster 6 年之前
父节点
当前提交
780ef2fce4
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      lfs.c

+ 1 - 1
lfs.c

@@ -29,7 +29,7 @@ static inline void lfs_cache_drop(lfs_t *lfs, lfs_cache_t *rcache) {
 
 
 static inline void lfs_cache_zero(lfs_t *lfs, lfs_cache_t *pcache) {
 static inline void lfs_cache_zero(lfs_t *lfs, lfs_cache_t *pcache) {
     // zero to avoid information leak
     // zero to avoid information leak
-    memset(pcache->buffer, 0xff, lfs->cfg->prog_size);
+    memset(pcache->buffer, 0xff, lfs->cfg->cache_size);
     pcache->block = 0xffffffff;
     pcache->block = 0xffffffff;
 }
 }