
February 2014. Someone duplicates one line in Apple's TLS code, a bare `goto fail;` sitting under an if that has no braces. It always jumps, so the signature check underneath it never runs, and every iPhone and Mac happily accepts forged certificates on any network. The line had been shipping for over a year. Here is the same shape: a chain of checks where only the first one ever happens.
Repair this code
Report the first step of the chain that fails, checking every step until one does.
Steps
$ first_bad_step({1,1,1}, 3)
-1
$ first_bad_step({1,0,1}, 3)
1
$ first_bad_step({0,0,0}, 3)
0
Expected files
Allowed functions
None. Write every helper yourself.
Loading solutions...