1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 06:31:14 +02:00

git/getStringUntil: fix uninitialized stack variable

at least clang-tidy is not convinced that this initialized.
If this is not the case, the impact should be small and hopefully also
more robust if changed.

(cherry picked from commit 7e540059a3)
This commit is contained in:
Jörg Thalheim 2025-03-21 15:43:39 +01:00 committed by Mergify
parent bc6e78402c
commit 7ef04ba6dd

View file

@ -33,7 +33,7 @@ std::optional<Mode> decodeMode(RawMode m) {
static std::string getStringUntil(Source & source, char byte) static std::string getStringUntil(Source & source, char byte)
{ {
std::string s; std::string s;
char n[1]; char n[1] = { 0 };
source(std::string_view { n, 1 }); source(std::string_view { n, 1 });
while (*n != byte) { while (*n != byte) {
s += *n; s += *n;