Oh god, that's horrifying. Get ready to check certificate validity, then report success before actually checking validity!
Re:About the security content of iOS 7.0.6
by gojomo on Saturday February 22, 2014 @04:21AM
(#7281527)
Wow. Maybe the inconsistent indentation and brackets-optional formatting helped the bug both arrive and persist?
Perhaps a preferable practice for security-conscious code would be to only set a success value after all checks have passed, rather than trust intervening logic to reset a default-success value, to an error-value, before return.
If you want to see my favorite SSL bug ever.