Add exception safety to load of the DNS disk cache
authorThomas Jarosch <thomas.jarosch@intra2net.com>
Wed, 7 Apr 2021 09:29:02 +0000 (11:29 +0200)
committerThomas Jarosch <thomas.jarosch@intra2net.com>
Wed, 7 Apr 2021 09:29:02 +0000 (11:29 +0200)
commitd92e7d020012b001001fb71351512365342ae2c2
tree9b504f758d9929b4a754a239bd6cdcb0a8b41ee1
parent6d3a7a37f69d3a2c98c850f7ab64ad9f87fb148e
Add exception safety to load of the DNS disk cache

A corrupted cache might throw an exception in the middle
of an unserialize operation. This might leave our DnsCache class
with an undefined data state.

Solution: Unserialize into local variables first, then do a
atomic swap() once everything could be parsed correctly.
src/dns/dnscache.cpp