Security flaws in critical infrastructure software could have meant disaster