- when we're not doing a recursive transfer, treat subdirectories as a

problem
This commit is contained in:
Nalin Dahyabhai 2009-06-04 19:27:50 +00:00
parent 6879d98ef2
commit 8c991219ab

25
krb5-1.7-rcp-markus.patch Normal file
View File

@ -0,0 +1,25 @@
Fix for CAN-2004-0175, based on Markus Friedl's fix for OpenSSH scp.
diff -up krb5-1.7/src/appl/bsd/krcp.c krb5-1.7/src/appl/bsd/krcp.c
--- krb5-1.7/src/appl/bsd/krcp.c 2009-06-04 14:27:20.000000000 -0400
+++ krb5-1.7/src/appl/bsd/krcp.c 2009-06-04 14:27:20.000000000 -0400
@@ -1038,6 +1038,10 @@ void sink(argc, argv)
size = size * 10 + (*cp++ - '0');
if (*cp++ != ' ')
SCREWUP("size not delimited");
+ if ((strchr(cp, '/') != NULL) || (strcmp(cp, "..") == 0)) {
+ error("error: unexpected filename: %s", cp);
+ exit(1);
+ }
if (targisdir) {
if(strlen(targ) + strlen(cp) + 2 >= sizeof(nambuf))
SCREWUP("target name too long");
@@ -1051,6 +1055,8 @@ void sink(argc, argv)
nambuf[sizeof(nambuf) - 1] = '\0';
exists = stat(nambuf, &stb) == 0;
if (cmdbuf[0] == 'D') {
+ if (!iamrecursive)
+ SCREWUP("received directory without -r");
if (exists) {
if ((stb.st_mode&S_IFMT) != S_IFDIR) {
errno = ENOTDIR;