diff options
Diffstat (limited to 'scp.c')
-rw-r--r-- | scp.c | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: scp.c,v 1.182 2015/04/24 01:36:00 deraadt Exp $ */ | 1 | /* $OpenBSD: scp.c,v 1.184 2015/11/27 00:49:31 deraadt Exp $ */ |
2 | /* | 2 | /* |
3 | * scp - secure remote copy. This is basically patched BSD rcp which | 3 | * scp - secure remote copy. This is basically patched BSD rcp which |
4 | * uses ssh to do the data transfer (instead of using rcmd). | 4 | * uses ssh to do the data transfer (instead of using rcmd). |
@@ -492,6 +492,16 @@ main(int argc, char **argv) | |||
492 | if (!isatty(STDOUT_FILENO)) | 492 | if (!isatty(STDOUT_FILENO)) |
493 | showprogress = 0; | 493 | showprogress = 0; |
494 | 494 | ||
495 | if (pflag) { | ||
496 | /* Cannot pledge: -p allows setuid/setgid files... */ | ||
497 | } else { | ||
498 | if (pledge("stdio rpath wpath cpath fattr tty proc exec", | ||
499 | NULL) == -1) { | ||
500 | perror("pledge"); | ||
501 | exit(1); | ||
502 | } | ||
503 | } | ||
504 | |||
495 | remin = STDIN_FILENO; | 505 | remin = STDIN_FILENO; |
496 | remout = STDOUT_FILENO; | 506 | remout = STDOUT_FILENO; |
497 | 507 | ||
@@ -874,7 +884,7 @@ rsource(char *name, struct stat *statp) | |||
874 | return; | 884 | return; |
875 | } | 885 | } |
876 | last = strrchr(name, '/'); | 886 | last = strrchr(name, '/'); |
877 | if (last == 0) | 887 | if (last == NULL) |
878 | last = name; | 888 | last = name; |
879 | else | 889 | else |
880 | last++; | 890 | last++; |