Hacker News new | past | comments | ask | show | jobs | submit login

Patch fixing the bug:

https://www.gitorious.org/gnutls/gnutls/commit/855127da290a2...

Basically, the code said

    bool isOk() {
        result = someCheckReturningNegativeOnFailure()
        if (result < 0) goto cleanup;

        cleanup:
            ...
            return result; 
    }
The issue is that failure is communicated with a negative number in one case and 0 in another, and the wires got crossed.



Yeah. While they're at it, why not change every function to return "int". Then just cast to proper type at usage. /s (And no, bool is not the proper way to go either.)

But seriously, I'm amazed that code this critical uses sloppy typing. I mean, they might as well use Python ffs. Maybe it's historical burden?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: