From ca900d471c9b3d3a22235dce68b6de566de0f1ca Mon Sep 17 00:00:00 2001 From: ryan Date: Wed, 19 Mar 2008 20:36:23 +0000 Subject: [PATCH] Check return of tmpfile(). see #5586 git-svn-id: http://svn.automattic.com/wordpress/trunk@7403 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/class-wp-filesystem-ftpext.php | 4 ++++ wp-admin/includes/class-wp-filesystem-ftpsockets.php | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/wp-admin/includes/class-wp-filesystem-ftpext.php b/wp-admin/includes/class-wp-filesystem-ftpext.php index b48a125162..12d56aa33b 100644 --- a/wp-admin/includes/class-wp-filesystem-ftpext.php +++ b/wp-admin/includes/class-wp-filesystem-ftpext.php @@ -152,6 +152,8 @@ class WP_Filesystem_FTPext{ $type = isset($this->filetypes[ $extension ]) ? $this->filetypes[ $extension ] : FTP_ASCII; } $temp = tmpfile(); + if ( ! $temp ) + return false; if( ! @ftp_fget($this->link,$temp,$file,$type,$resumepos) ) return false; fseek($temp, 0); //Skip back to the start of the file being written to @@ -171,6 +173,8 @@ class WP_Filesystem_FTPext{ $type = isset($this->filetypes[ $extension ]) ? $this->filetypes[ $extension ] : FTP_ASCII; } $temp = tmpfile(); + if ( ! $temp ) + return false; fwrite($temp,$contents); fseek($temp, 0); //Skip back to the start of the file being written to $ret = @ftp_fput($this->link,$file,$temp,$type); diff --git a/wp-admin/includes/class-wp-filesystem-ftpsockets.php b/wp-admin/includes/class-wp-filesystem-ftpsockets.php index fbac7b7e41..11d4e83c22 100644 --- a/wp-admin/includes/class-wp-filesystem-ftpsockets.php +++ b/wp-admin/includes/class-wp-filesystem-ftpsockets.php @@ -159,6 +159,8 @@ class WP_Filesystem_ftpsockets{ } $this->ftp->SetType($type); $temp = tmpfile(); + if ( ! $temp ) + return false; if ( ! $this->ftp->fget($temp, $file) ) { fclose($temp); return ''; //Blank document, File does exist, Its just blank. @@ -183,6 +185,8 @@ class WP_Filesystem_ftpsockets{ $this->ftp->SetType($type); $temp = tmpfile(); + if ( ! $temp ) + return false; fwrite($temp,$contents); fseek($temp, 0); //Skip back to the start of the file being written to $ret = $this->ftp->fput($file, $temp);