]> git.ipfire.org Git - thirdparty/squid.git/commit - src/store_io.cc
Avoid null pointer dereferences when dynamic_cast'ing to SwapDir (#743)
authorEduard Bagdasaryan <eduard.bagdasaryan@measurement-factory.com>
Tue, 27 Oct 2020 19:44:57 +0000 (19:44 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Tue, 27 Oct 2020 20:09:51 +0000 (20:09 +0000)
commit5d84beb598998a38d42075f33a1d0b3ae64f759e
tree5ad999b101708326c5b475e1f8e455404e4c3ab7
parent9fa45f86f6bd84fa59cf119e592abf1f1b668739
Avoid null pointer dereferences when dynamic_cast'ing to SwapDir (#743)

Detected by Coverity. CID 1461158: Null pointer dereferences
(FORWARD_NULL).

When fixing these problems, we moved a few cache_dir iterations into
Disks.cc by applying the "Only Store::Disks can iterate cache_dirs"
design principle to the changed code. The Disks class is responsible for
maintaining (and will eventually encapsulate all the knowledge of) the
set of cache_dirs. Adjusted cache_cf.cc no longer depends on Disk.h.
16 files changed:
src/Makefile.am
src/StoreFileSystem.cc
src/StoreFileSystem.h
src/cache_cf.cc
src/store.cc
src/store/Controller.cc
src/store/Controller.h
src/store/Disks.cc
src/store/Disks.h
src/store_io.cc
src/store_rebuild.cc
src/tests/stub_libstore.cc
src/tests/testRock.cc
src/tests/testStoreController.cc
src/tests/testStoreHashIndex.cc
src/tests/testUfs.cc