News for hackers. Stuff that matters.
Re:OpenSSL 3.0.7 Published by jancsika on Tuesday November 01, 2022 @12:26PM (#33423444)
I don't understand this one:

     -                (written_out - i) * sizeof *pDecoded);
     +                (written_out - i) * sizeof(*pDecoded));
Edit: just to be clear-- I'm claiming there's no way the addition of parentheses could change the behavior of the program.

I guess I can understand resolving an ambiguity so that the reader doesn't have to look up precedence rules. But when combined with a high-profile bug in a critical piece of infrastructure it looks a bit like the software equivalent of not shaving one's beard in the hopes of winning a sports tournament.

Re:OpenSSL 3.0.7 Published by bewaretheirs on Tuesday November 01, 2022 @12:35PM (#33423574)
Looks to me like a coding style fix along for the ride with the correctness fix.
Re:OpenSSL 3.0.7 Published by Retr0id on Tuesday November 01, 2022 @12:35PM (#33423580)
I don't think that's security-relevant, likely just keeping a linter happy.
Re:OpenSSL 3.0.7 Published by jancsika on Tuesday November 01, 2022 @01:45PM (#33424652)
Ah, I didn't think about a linter. I'll take a look at the code later to see if that's the case.
Re:OpenSSL 3.0.7 Published by nurettin on Tuesday November 01, 2022 @12:36PM (#33423588)
sizeof is a keyword because of some terrible reason, but I'd parenthesize it just to make the intention clear.
Re:OpenSSL 3.0.7 Published by Sohcahtoa82 on Tuesday November 01, 2022 @12:55PM (#33423856)
Agreed. sizeof FEELS like a function, and so I use parentheses with it, even though I know it's not actually a function.
Re:OpenSSL 3.0.7 Published by krylon on Tuesday November 01, 2022 @04:32PM (#33427088)
Wasn't there some subtle difference between using sizeof with vs without parens? Something like if you pass a type to sizeof -- e.g. sizeof(*int) -- you must use parents anyway? It's been years since I've used C, I'm probably not remembering it correctly.
Re:OpenSSL 3.0.7 Published by scatters on Tuesday November 01, 2022 @09:16PM (#33430251)
Yes, exactly that. `sizeof(int)` OK, `sizeof(i)` OK, `sizeof i` OK, `sizeof int` not OK. One of those weird rules.
Re:OpenSSL 3.0.7 Published by sapiogram on Tuesday November 01, 2022 @01:05PM (#33424010)
Why is sizeof a terrible keyword? Just think of it as an operator rather than a function.
Re:OpenSSL 3.0.7 Published by nurettin on Wednesday November 02, 2022 @12:42AM (#33431520)
Should have been a callable, or should have had consistent syntax to prevent people from being clever.