-
Notifications
You must be signed in to change notification settings - Fork 257
src/sulogin.c: Free previously allocated memory #908
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
It would be nice if Is there interest in this for another pull request? |
|
That would be good to do if we're doing this patch, because here we are depending Alternatively, we could introduce a pw_init() function which zeroes the pwent at the
This patch is depending on pwent being in BSS so it starts out zeroed. So don't just Anyway, I'll note that while this 'out of memory' is not a security issue (since this |
That's the only file where it's called, and it's a delicate function. Reduce the chances that other files call it. Link: <shadow-maint#908> Suggested-by: Samanta Navarro <ferivoz@riseup.net> Cc: Serge Hallyn <serge@hallyn.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
That's the only file where it's called, and it's a delicate function. Reduce the chances that other files call it. Link: <shadow-maint#908> Suggested-by: Samanta Navarro <ferivoz@riseup.net> Cc: Serge Hallyn <serge@hallyn.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
That's the only file where it's called, and it's a delicate function. Reduce the chances that other files call it. Link: <shadow-maint#908> Suggested-by: Samanta Navarro <ferivoz@riseup.net> Cc: Serge Hallyn <serge@hallyn.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
That's the only file where it's called, and it's a delicate function. Reduce the chances that other files call it. Link: <#908> Suggested-by: Samanta Navarro <ferivoz@riseup.net> Cc: Serge Hallyn <serge@hallyn.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
Rebased on current master. Thank you for refactoring the mentioned parts @alejandro-colomar! |
|
Thank you! |
|
Oh, you should probably keep the Co-authored-by (or Co-developed-by, as you prefer) line next to the signed-off-by. :) |
The sulogin program calls pw_entry in a loop while incorrect root passwords are entered. Free the previously allocated memory to avoid memory exhaustion. Co-developed-by: Alejandro Colomar <alx@kernel.org> Signed-off-by: Alejandro Colomar <alx@kernel.org> Signed-off-by: Samanta Navarro <ferivoz@riseup.net>
|
It would be nice, if anyone feels included to do more with this code, to replace void pw_entry() with int pw_entry() which returns error if we run out of memory. Furthermore, given doc/HOWTO note on AUTOSHADOW, which is referenced in this hunk, it seems like we ought to also drop that, and just refuse to compile if AUTOSHADOW is set. |
Yup, I had this in my plans. @hallyn
I don't even know what AUTOSHADOW is. I've been seeing that thing and trying to ignore it. :D |
The sulogin program calls pw_entry in a loop while incorrect root passwords are entered.
Free the previously allocated memory to avoid memory exhaustion.
Proof of Concept (compile with -fsanitize=address):
Run
suloginand enter wrong root passwords multiple times. Then press CTRL+D. You can see as many direct leaks as wrong passwords have been entered.