[openssh-commits] [openssh] 01/02: explicitly test set[ug]id() return values

git+noreply at mindrot.org git+noreply at mindrot.org
Fri Sep 13 13:16:50 AEST 2019


This is an automated email from the git hooks/post-receive script.

djm pushed a commit to branch master
in repository openssh.

commit c17e4638e5592688264fc0349f61bfc7b4425aa5
Author: Damien Miller <djm at mindrot.org>
Date:   Fri Sep 13 13:12:42 2019 +1000

    explicitly test set[ug]id() return values
    
    Legacy !_POSIX_SAVED_IDS path only; coverity report via Ed Maste
    ok dtucker@
---
 uidswap.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/uidswap.c b/uidswap.c
index 1d78c607..40e12150 100644
--- a/uidswap.c
+++ b/uidswap.c
@@ -162,8 +162,10 @@ restore_uid(void)
 	 * Propagate the real uid (usually more privileged) to effective uid
 	 * as well.
 	 */
-	setuid(getuid());
-	setgid(getgid());
+	if (setuid(getuid()) == -1)
+		fatal("%s: setuid failed: %s", __func__, strerror(errno));
+	if (setgid(getgid()) == -1)
+		fatal("%s: setgid failed: %s", __func__, strerror(errno));
 #endif /* SAVED_IDS_WORK_WITH_SETEUID */
 
 	if (setgroups(saved_egroupslen, saved_egroups) == -1)

-- 
To stop receiving notification emails like this one, please contact
djm at mindrot.org.


More information about the openssh-commits mailing list