diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml index ad8e159..aca29fd 100644 --- a/.github/workflows/c-cpp.yml +++ b/.github/workflows/c-cpp.yml @@ -37,7 +37,7 @@ jobs: sudo mkdir /cores sudo cp fsck/fsck.exfat /cores cd tests - sudo ./test_fsck.sh + sudo ./test_fsck.sh bad_root sudo coredumpctl list sudo chmod -R a+rwx /cores sudo coredumpctl dump | gzip -c > /cores/core.gz diff --git a/fsck/fsck.c b/fsck/fsck.c index a5517d2..7edb19f 100644 --- a/fsck/fsck.c +++ b/fsck/fsck.c @@ -569,14 +569,16 @@ static uint16_t file_calc_checksum(struct exfat_de_iter *iter) { uint16_t checksum; struct exfat_dentry *file_de, *de; - int i; + int i, ret; checksum = 0; exfat_de_iter_get(iter, 0, &file_de); exfat_calc_dentry_checksum(file_de, &checksum, true); for (i = 1; i <= file_de->file_num_ext; i++) { - exfat_de_iter_get(iter, i, &de); + ret = exfat_de_iter_get(iter, i, &de); + if (ret) + return 0; exfat_calc_dentry_checksum(de, &checksum, false); } return checksum;