Skip to content

Commit 1793d4c

Browse files
committed
pppd: Check access to options files invoked with the call option
This checks, using ppp_check_access(), that files invoked using the "call" option can't be tampered with by non-root processes. Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
1 parent 030c350 commit 1793d4c

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

pppd/options.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1640,6 +1640,7 @@ callfile(char **argv)
16401640
{
16411641
char *fname, *arg, *p;
16421642
int l, ok;
1643+
char *realname;
16431644

16441645
arg = *argv;
16451646
ok = 1;
@@ -1668,9 +1669,15 @@ callfile(char **argv)
16681669
slprintf(fname, l, "%s%s", PPP_PATH_PEERFILES, arg);
16691670
ppp_script_setenv("CALL_FILE", arg, 0);
16701671

1671-
ok = ppp_options_from_file(fname, 1, 1, 1);
1672+
if (!ppp_check_access(fname, &realname, 1, 0)) {
1673+
free(fname);
1674+
return 0;
1675+
}
1676+
1677+
ok = ppp_options_from_file(realname, 1, 1, 1);
16721678

16731679
free(fname);
1680+
free(realname);
16741681
return ok;
16751682
}
16761683

0 commit comments

Comments
 (0)