Finally, a bug which could not be fixed by using Rust :D
I am by no means a Rust fanboy, but I actually disagree in this case. The root cause of this appears to be incorrect error checking and I think this is caused by in-band signalling of error results. A language with union types that required an explicit match to differentiate between the error and non-error case would have prevented this kind of error.
Well, it was worth a try ;) Thanks for the clarification :)
In fairness, this looks like the kind of bug that’s harder to write in Rust since you’ve got to handle the error value (or explicitly ignore it) to get the success value. Polkit’s errors are a bit like tagged unions (without the union) in that the returned boolean tells you whether the *out_uid/*out_pid or the *error value is valid, but in this case the wrong tag was being returned. Putting them in a proper sum type would help with that.
finally? many more of those around, take my favourite of the year:
I can’t seem to reproduce this bug on HardenedBSD. I wonder if any of the other BSDs are affected, but I kind of think they might not be.
Gotta love the GoldenEye reference.