diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | scp.c | 16 |
2 files changed, 14 insertions, 8 deletions
@@ -43,6 +43,10 @@ | |||
43 | - jmc@cvs.openbsd.org 2007/06/12 13:43:55 | 43 | - jmc@cvs.openbsd.org 2007/06/12 13:43:55 |
44 | [ssh.1] | 44 | [ssh.1] |
45 | add -K to SYNOPSIS; | 45 | add -K to SYNOPSIS; |
46 | - dtucker@cvs.openbsd.org 2007/06/12 13:54:28 | ||
47 | [scp.c] | ||
48 | Encode filename with strnvis if the name contains a newline (which can't | ||
49 | be represented in the scp protocol), from bz #891. ok markus@ | ||
46 | 50 | ||
47 | 20070611 | 51 | 20070611 |
48 | - (djm) Bugzilla #1306: silence spurious error messages from hang-on-exit | 52 | - (djm) Bugzilla #1306: silence spurious error messages from hang-on-exit |
@@ -3057,4 +3061,4 @@ | |||
3057 | OpenServer 6 and add osr5bigcrypt support so when someone migrates | 3061 | OpenServer 6 and add osr5bigcrypt support so when someone migrates |
3058 | passwords between UnixWare and OpenServer they will still work. OK dtucker@ | 3062 | passwords between UnixWare and OpenServer they will still work. OK dtucker@ |
3059 | 3063 | ||
3060 | $Id: ChangeLog,v 1.4698 2007/06/12 14:00:58 dtucker Exp $ | 3064 | $Id: ChangeLog,v 1.4699 2007/06/12 14:02:07 dtucker Exp $ |
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: scp.c,v 1.157 2007/06/12 08:24:20 djm Exp $ */ | 1 | /* $OpenBSD: scp.c,v 1.158 2007/06/12 13:54:28 dtucker 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). |
@@ -96,6 +96,9 @@ | |||
96 | #include <string.h> | 96 | #include <string.h> |
97 | #include <time.h> | 97 | #include <time.h> |
98 | #include <unistd.h> | 98 | #include <unistd.h> |
99 | #if defined(HAVE_STRNVIS) && defined(HAVE_VIS_H) | ||
100 | #include <vis.h> | ||
101 | #endif | ||
99 | 102 | ||
100 | #include "xmalloc.h" | 103 | #include "xmalloc.h" |
101 | #include "atomicio.h" | 104 | #include "atomicio.h" |
@@ -582,7 +585,7 @@ source(int argc, char **argv) | |||
582 | off_t i, amt, statbytes; | 585 | off_t i, amt, statbytes; |
583 | size_t result; | 586 | size_t result; |
584 | int fd = -1, haderr, indx; | 587 | int fd = -1, haderr, indx; |
585 | char *last, *name, buf[2048]; | 588 | char *last, *name, buf[2048], encname[MAXPATHLEN]; |
586 | int len; | 589 | int len; |
587 | 590 | ||
588 | for (indx = 0; indx < argc; ++indx) { | 591 | for (indx = 0; indx < argc; ++indx) { |
@@ -591,13 +594,12 @@ source(int argc, char **argv) | |||
591 | len = strlen(name); | 594 | len = strlen(name); |
592 | while (len > 1 && name[len-1] == '/') | 595 | while (len > 1 && name[len-1] == '/') |
593 | name[--len] = '\0'; | 596 | name[--len] = '\0'; |
594 | if (strchr(name, '\n') != NULL) { | ||
595 | run_err("%s: skipping, filename contains a newline", | ||
596 | name); | ||
597 | goto next; | ||
598 | } | ||
599 | if ((fd = open(name, O_RDONLY|O_NONBLOCK, 0)) < 0) | 597 | if ((fd = open(name, O_RDONLY|O_NONBLOCK, 0)) < 0) |
600 | goto syserr; | 598 | goto syserr; |
599 | if (strchr(name, '\n') != NULL) { | ||
600 | strnvis(encname, name, sizeof(encname), VIS_NL); | ||
601 | name = encname; | ||
602 | } | ||
601 | if (fstat(fd, &stb) < 0) { | 603 | if (fstat(fd, &stb) < 0) { |
602 | syserr: run_err("%s: %s", name, strerror(errno)); | 604 | syserr: run_err("%s: %s", name, strerror(errno)); |
603 | goto next; | 605 | goto next; |