path = g_strdup (argv[n]);
How many code smells can you detect in that one single line?
path = g_strdup (argv[n]);
How many code smells can you detect in that one single line?
n while path is defined outside of the loop, so it needs to free on every iteration or it just overwrites path and leaksLet me kill the suspense: it is pkexec https://github.com/polkit-org/polkit/blob/main/src/programs/pkexec.c#L663
The entirety of the polkit code is like this.
"Bro, how many strdups do I need?"
"Yes."
I originally just wanted to see how polkit uses PAM, how it interacts with it, check that there isn't some kind of dark voodoo happening since they share some common goals.
What I'm finding is more reasons to stay away from polkit in case you didn't have enough of them.
The argv array is mutable, so there's an argument for defensive copies if something else in the program might mutate them. But that just raises even more questions.
@david_chisnall Indeed, I always tend to forget that argv is mutable, because mutating it is another code smell 😅