From 0163e8928c624251456adacb669a94a4adf230ff Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 30 Oct 2018 11:45:31 +0100 Subject: [PATCH] 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. --- src/libstore/s3-binary-cache-store.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libstore/s3-binary-cache-store.cc b/src/libstore/s3-binary-cache-store.cc index ba11ce6bb..13ee257ba 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 - &transferHandle) + [](const TransferManager *transferManager, + const std::shared_ptr + &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()); };