about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2018-10-30T10·45+0100
committerEelco Dolstra <edolstra@gmail.com>2018-10-30T10·45+0100
commit0163e8928c624251456adacb669a94a4adf230ff (patch)
tree30d2fdead80d363553c9853509ce30b6ab87ef33
parent056c3fbbfc3ef61b7a63548521bef153acfe2106 (diff)
Fix broken uploadProgressCallback closure
Since the callback is global we can't refer to 'path' in it. This
could cause a segfault or printing of arbitrary data.
-rw-r--r--src/libstore/s3-binary-cache-store.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libstore/s3-binary-cache-store.cc b/src/libstore/s3-binary-cache-store.cc
index ba11ce6bb6de..13ee257ba253 100644
--- a/src/libstore/s3-binary-cache-store.cc
+++ b/src/libstore/s3-binary-cache-store.cc
@@ -269,14 +269,14 @@ struct S3BinaryCacheStoreImpl : public S3BinaryCacheStore
             transferConfig.bufferSize = bufferSize;
 
             transferConfig.uploadProgressCallback =
-                [&](const TransferManager *transferManager,
-                    const std::shared_ptr<const TransferHandle>
-                    &transferHandle)
+                [](const TransferManager *transferManager,
+                   const std::shared_ptr<const TransferHandle>
+                   &transferHandle)
                 {
                     //FIXME: find a way to properly abort the multipart upload.
                     //checkInterrupt();
                     debug("upload progress ('%s'): '%d' of '%d' bytes",
-                        path,
+                        transferHandle->GetKey(),
                         transferHandle->GetBytesTransferred(),
                         transferHandle->GetBytesTotalSize());
                 };