Update to set gid
This commit is contained in:
parent
2910645c96
commit
34378eba52
1 changed files with 4 additions and 0 deletions
|
@ -1,13 +1,17 @@
|
||||||
//compile with:
|
//compile with:
|
||||||
//gcc -m32 -std=c99 -Wall -fno-stack-protector doubly_dangerous.c -o doubly_dangerous
|
//gcc -m32 -std=c99 -Wall -fno-stack-protector doubly_dangerous.c -o doubly_dangerous
|
||||||
|
|
||||||
|
#define _GNU_SOURCE
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
void give_flag() {
|
void give_flag() {
|
||||||
FILE *f = fopen("flag.txt", "r");
|
FILE *f = fopen("flag.txt", "r");
|
||||||
|
gid_t gid = getegid();
|
||||||
|
setresgid(gid, gid, gid);
|
||||||
if (f != NULL) {
|
if (f != NULL) {
|
||||||
char c;
|
char c;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue