[openssh-commits] [openssh] 01/02: upstream commit
git+noreply at mindrot.org
git+noreply at mindrot.org
Tue Jun 23 10:34:56 AEST 2015
This is an automated email from the git hooks/post-receive script.
djm pushed a commit to branch master
in repository openssh.
commit 63b78d003bd8ca111a736e6cea6333da50f5f09b
Author: dtucker at openbsd.org <dtucker at openbsd.org>
Date: Mon Jun 22 12:29:57 2015 +0000
upstream commit
Don't call setgroups if we have zero groups; there's no
guarantee that it won't try to deref the pointer. Based on a patch from mail
at quitesimple.org, ok djm deraadt
Upstream-ID: 2fff85e11d7a9a387ef7fddf41fbfaf566708ab1
---
uidswap.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/uidswap.c b/uidswap.c
index f2713fd..27a2faa 100644
--- a/uidswap.c
+++ b/uidswap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uidswap.c,v 1.37 2015/01/16 06:40:12 deraadt Exp $ */
+/* $OpenBSD: uidswap.c,v 1.38 2015/06/22 12:29:57 dtucker Exp $ */
/*
* Author: Tatu Ylonen <ylo at cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo at cs.hut.fi>, Espoo, Finland
@@ -113,7 +113,7 @@ temporarily_use_uid(struct passwd *pw)
}
}
/* Set the effective uid to the given (unprivileged) uid. */
- if (setgroups(user_groupslen, user_groups) < 0)
+ if (user_groupslen > 0 && setgroups(user_groupslen, user_groups) < 0)
fatal("setgroups: %.100s", strerror(errno));
#ifndef SAVED_IDS_WORK_WITH_SETEUID
/* Propagate the privileged gid to all of our gids. */
@@ -187,7 +187,8 @@ restore_uid(void)
setgid(getgid());
#endif /* SAVED_IDS_WORK_WITH_SETEUID */
- if (setgroups(saved_egroupslen, saved_egroups) < 0)
+ if (saved_egroupslen > 0 &&
+ setgroups(saved_egroupslen, saved_egroups) < 0)
fatal("setgroups: %.100s", strerror(errno));
temporarily_use_uid_effective = 0;
}
--
To stop receiving notification emails like this one, please contact
djm at mindrot.org.
More information about the openssh-commits
mailing list