Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

CVE-2014-3956


Replying with a CVE is like icing on the cake. :) It really shows that OpenBSD devs take security seriously. Funny timing, I was just reading Absolute OpenBSD.


It also demonstrates that sometimes, there are additional constraints that you may not understand in choices you may not agree with.


OK, agreed. C (and C++) just suck regarding this detail.


I don't see how that's relevant.

The bug in that CVE is that the function call got the parameter order wrong. The declaration was correct AFAICT, and of course completely irrelevant because you can make that mistake regardless of what the header says.

Parameters in headers are just documentation, by definition. Documentation can be wrong however you write it, but in general it helps to have it instead of not. Would you seriously argue that function parameters should not be given names in documentation?


> The bug in that CVE is that the function call got the parameter order wrong. The declaration was correct AFAICT

Actually if you look at the patch to fix this issue, they swap the identifiers in the declarator. Of course when something like this happens, you're free to choose whether the definition or the callers should be changed.

https://www.FreeBSD.org/security/patches/SA-14:11/sendmail.p...


That's the function definition, not its declaration. It's pre-ANSI C, so that semicolon can mislead. I didn't bother to grab the source to check whatever the header said (or, heh, didn't say, per OpenBSD convention), but I'm going to assume it was correct.

It amuses me greatly that we're sitting here arguing over the minutiae of coding standards when this thing is still written in K&R syntax.

But regardless: whatever the header said, it wouldn't have affected this bug, which was just a straightforward transpose thing between compatible types. People get memcpy() reversed all the time too, and frankly I don't know if I've ever looked at its function declaration in a header.


i would argue that had the function prototype had names for it's arguments that this might not have happened.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

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

Search: