Index: wp-admin/includes/class-wp-filesystem-direct.php
===================================================================
--- wp-admin/includes/class-wp-filesystem-direct.php	(revision 17191)
+++ wp-admin/includes/class-wp-filesystem-direct.php	(working copy)
@@ -62,8 +62,12 @@
 	function put_contents($file, $contents, $mode = false ) {
 		if ( ! ($fp = @fopen($file, 'w')) )
 			return false;
-		@fwrite($fp, $contents);
+		$bytes_written = @fwrite($fp, $contents);
 		@fclose($fp);
+		if ( false === $bytes_written || is_int($bytes_written) && $bytes_written < strlen($contents) ) {
+			$this->delete($file);
+			return false;
+		}
 		$this->chmod($file, $mode);
 		return true;
 	}
Index: wp-admin/includes/class-wp-filesystem-ftpext.php
===================================================================
--- wp-admin/includes/class-wp-filesystem-ftpext.php	(revision 17191)
+++ wp-admin/includes/class-wp-filesystem-ftpext.php	(working copy)
@@ -121,7 +121,13 @@
 		if ( ! $temp )
 			return false;
 
-		fwrite($temp, $contents);
+		$bytes_written = fwrite($temp, $contents);
+		if ( false === $bytes_written || is_int($bytes_written) && $bytes_written < strlen($contents) ) {
+			fclose($temp);
+			unlink($tempfile);
+			return false;
+		}
+
 		fseek($temp, 0); //Skip back to the start of the file being written to
 
 		$type = $this->is_binary($contents) ? FTP_BINARY : FTP_ASCII;
Index: wp-admin/includes/class-wp-filesystem-ftpsockets.php
===================================================================
--- wp-admin/includes/class-wp-filesystem-ftpsockets.php	(revision 17191)
+++ wp-admin/includes/class-wp-filesystem-ftpsockets.php	(working copy)
@@ -122,7 +122,12 @@
 			return false;
 		}
 
-		fwrite($temphandle, $contents);
+		$bytes_written = fwrite($temphandle, $contents);
+		if ( false === $bytes_written || is_int($bytes_written) && $bytes_written < strlen($contents) ) {
+			fclose($temphandle);
+			unlink($temp);
+			return false;
+		}
 		fseek($temphandle, 0); //Skip back to the start of the file being written to
 
 		$type = $this->is_binary($contents) ? FTP_BINARY : FTP_ASCII;
Index: wp-admin/includes/file.php
===================================================================
--- wp-admin/includes/file.php	(revision 17191)
+++ wp-admin/includes/file.php	(working copy)
@@ -537,9 +537,14 @@
 		return new WP_Error('http_404', trim($response['response']['message']));
 	}
 
-	fwrite($handle, $response['body']);
+	$bytes_written = fwrite($handle, $response['body']);
 	fclose($handle);
 
+	if ( false === $bytes_written || is_int($bytes_written) && $bytes_written < strlen($response['body']) ) {
+		unlink($tmpfname);
+		return new WP_Error('http_cannot_write', __('Could not write to the temporary file. There may not be enough diskspace.') );
+	}
+
 	return $tmpfname;
 }
 
