Even though the code got better with this fix I still wouldn't accept code that looks like this in a review. Why are 1, 2, 3, 16 not defines? What's up with the code duplication between files? Where are the unit-tests?
I'm starting to feel that a lot of software that has been around for 10+ years and is commonly used does not live up to current best practices regarding writing good system-level software.
I get the impression that this applies to openssl far more than other software. The code base is a mess, and it's security sensitive. So people dare not touch it.
It's a shame that there isn't a better incentive for this particular code base to be fixed.
if (1 + 2 + 16 > s->s3->rrec.length)
if (1 + 2 + payload + 16 > s->s3->rrec.length)
Come on. At least use a macro or something.This always makes me cringe during code reviews.
https://news.ycombinator.com/item?id=7282005
but the thread is a lot heftier now.