Created
June 18, 2014 14:58
-
-
Save spiculator/281c923919de42530b93 to your computer and use it in GitHub Desktop.
fix vulnarability in jail chroot tool
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/jail.c b/src/jail.c | |
index ecf0cb3..9b1da64 100644 | |
--- a/src/jail.c | |
+++ b/src/jail.c | |
@@ -453,8 +453,14 @@ int main(int argc, char *argv[], char *env[]) { | |
// call the shell overriding current process space | |
// | |
- setgid(gid); | |
- setuid(uid); | |
+ if( 0 != setgid(gid) ) { | |
+ perror("setgid"); | |
+ exit(EXIT_FAILURE); | |
+ } | |
+ if( 0 != setuid(uid) ) { | |
+ perror("setuid"); | |
+ exit(EXIT_FAILURE); | |
+ } | |
#if DEBUG != 0 | |
fprintf(stderr,"jail: doing chdir(%s)\n",ptr_home_dir); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment