diff options
author | Farid Zakaria <fmzakari@google.com> | 2021-11-18 04:00:19 +0000 |
---|---|---|
committer | Farid Zakaria <fmzakari@google.com> | 2021-11-18 04:05:25 +0000 |
commit | bc14465e08a286f8bc3b1e47e70372352b64bd2c (patch) | |
tree | 1503e9f5a2f3b7ec9b479e11dbf605ac53b49591 | |
parent | 480c883f363912df611c545b05ae0f6f1b9a6c61 (diff) |
Fix stack buffer overflow
Fix a stack buffer overflow found by running MemorySanitizer.
-rw-r--r-- | src/libstore/references.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libstore/references.cc b/src/libstore/references.cc index c369b14ac..bb9590acb 100644 --- a/src/libstore/references.cc +++ b/src/libstore/references.cc @@ -54,7 +54,7 @@ void RefScanSink::operator () (std::string_view data) fragment, so search in the concatenation of the tail of the previous fragment and the start of the current fragment. */ auto s = tail; - s.append(data.data(), refLength); + s.append(data.data(), std::min(data.size(), refLength)); search(s, hashes, seen); search(data, hashes, seen); |