Apple patches spyware flaw affecting all operating systems