You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by ga...@apache.org on 2019/11/09 03:09:04 UTC

[jclouds] branch master updated: Fix TOCTOU issue when getting blob during removal

This is an automated email from the ASF dual-hosted git repository.

gaul pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jclouds.git


The following commit(s) were added to refs/heads/master by this push:
     new febc9b7  Fix TOCTOU issue when getting blob during removal
febc9b7 is described below

commit febc9b73df295d466816b9ae11a5299c5dd9f902
Author: Andrew Gaul <ga...@apache.org>
AuthorDate: Sat Nov 9 11:25:24 2019 +0900

    Fix TOCTOU issue when getting blob during removal
    
    Fixes gaul/s3proxy#318.
---
 .../src/main/java/org/jclouds/blobstore/config/LocalBlobStore.java  | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/blobstore/src/main/java/org/jclouds/blobstore/config/LocalBlobStore.java b/blobstore/src/main/java/org/jclouds/blobstore/config/LocalBlobStore.java
index e1dab9f..9c521be 100644
--- a/blobstore/src/main/java/org/jclouds/blobstore/config/LocalBlobStore.java
+++ b/blobstore/src/main/java/org/jclouds/blobstore/config/LocalBlobStore.java
@@ -636,14 +636,14 @@ public final class LocalBlobStore implements BlobStore {
          logger.debug("Container %s does not exist", containerName);
          throw cnfe(containerName);
       }
+
       // If the blob doesn't exist, a null object is returned
-      if (!storageStrategy.blobExists(containerName, key)) {
+      Blob blob = loadBlob(containerName, key);
+      if (blob == null) {
          logger.debug("Item %s does not exist in container %s", key, containerName);
          return null;
       }
 
-      Blob blob = loadBlob(containerName, key);
-
       if (options != null) {
          String eTag = blob.getMetadata().getETag();
          if (eTag != null) {