Line 0
Link Here
|
|
|
1 |
/* |
2 |
* https://bugs.gentoo.org/599706 |
3 |
* |
4 |
*/ |
5 |
|
6 |
#include "headers.h" |
7 |
|
8 |
int main(int argc, char *argv[]) |
9 |
{ |
10 |
if (argc < 3) |
11 |
return -2; |
12 |
|
13 |
uid_t uid = atoi(argv[1]); |
14 |
gid_t gid = atoi(argv[2]); |
15 |
/* The sandbox catches this: |
16 |
* |
17 |
* int fd = open(argv[3], O_RDWR); |
18 |
* |
19 |
* And it /should/ catch this: |
20 |
* |
21 |
* int fd = open(argv[3], O_RDONLY); |
22 |
*/ |
23 |
int fd = open(argv[3], O_RDONLY); |
24 |
int fchown_result = fchown(fd, uid, gid); |
25 |
close(fd); |
26 |
return fchown_result; |
27 |
} |