Skip to content

Instantly share code, notes, and snippets.

@jrmoserbaltimore
Created February 22, 2016 00:32
Show Gist options
  • Save jrmoserbaltimore/4a8de746160c4ccd2f96 to your computer and use it in GitHub Desktop.
Save jrmoserbaltimore/4a8de746160c4ccd2f96 to your computer and use it in GitHub Desktop.
Ways to misread an if statement if you're blind and stupid
hashOut.data = hashes + SSL_MD5_DIGEST_LEN;
hashOut.length = SSL_SHA1_DIGEST_LEN;
if ((err = SSLFreeBuffer(&hashCtx)) != 0)
goto fail;
if ((err = ReadyHash(&SSLHashSHA1, &hashCtx)) != 0)
goto fail;
if ((err = SSLHashSHA1.update(&hashCtx, &clientRandom)) != 0)
goto fail;
if ((err = SSLHashSHA1.update(&hashCtx, &serverRandom)) != 0)
goto fail;
if ((err = SSLHashSHA1.update(&hashCtx, &signedParams)) != 0)
{
goto fail;
}
goto fail; /* MISTAKE! THIS LINE SHOULD NOT BE HERE */
if ((err = SSLHashSHA1.final(&hashCtx, &hashOut)) != 0)
goto fail;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment