logoalt Hacker News

mort96yesterday at 10:14 AM1 replyview on HN

Is that true though?

Using defer, the code would be:

    if ((err = SSLHashSHA1.update(&hashCtx, &signedParams)) != 0)
        return err;
        return err;
This has the exact same bug: the function exits with a successful return code as long as the SHA hash update succeeds, skipping further certificate validity checks. The fact that resource cleanup has been relegated to defer so that 'goto fail;' can be replaced with 'return err;' fixes nothing.

Replies

anilakaryesterday at 10:33 AM

It would have resulted in an uninitialized variable access warning, though.

show 2 replies