From 649f8a733742f0b5c3b7b939f35e81d4e55632c2 Mon Sep 17 00:00:00 2001
From: Bob Vincent <bobvin@pillars.net>
Date: Mon, 19 Sep 2011 00:21:40 -0400
Subject: [PATCH] Issue #1283502: FileTransfer::checkPath() uses
 drupal_realpath() where it should use realpath() instead.

---
 includes/filetransfer/filetransfer.inc |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/includes/filetransfer/filetransfer.inc b/includes/filetransfer/filetransfer.inc
index aa7ebe470e2eed3a2f942f0831054f40ea089b36..a3f047855044c4f87f2a32a4f67eae74df6c948d 100644
--- a/includes/filetransfer/filetransfer.inc
+++ b/includes/filetransfer/filetransfer.inc
@@ -157,7 +157,10 @@ abstract class FileTransfer {
    */
   protected final function checkPath($path) {
     $full_jail = $this->chroot . $this->jail;
-    $full_path = drupal_realpath(substr($this->chroot . $path, 0, strlen($full_jail)));
+    // We use realpath() here instead of drupal_realpath() because the argument
+    // begins with $this->chroot which is guaranteed to be a local filesystem
+    // path, not a stream wrapper URI.
+    $full_path = realpath(substr($this->chroot . $path, 0, strlen($full_jail)));
     $full_path = $this->fixRemotePath($full_path, FALSE);
     if ($full_jail !== $full_path) {
       throw new FileTransferException('@directory is outside of the @jail', NULL, array('@directory' => $path, '@jail' => $this->jail));
-- 
1.7.5.4

