Skip to content

Commit 163a89d

Browse files
committed
fix(channeltester): improve error message construction for test start argument validation
1 parent af2dcd6 commit 163a89d

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

src/channeltester/ChannelTester.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,14 @@ class StartTestingCommand : public Command {
154154
// argument value - that is a separate defect from this one.
155155
size_t needed = (args.size() > 1 && args[1] == "Single Channel Chase") ? 5 : 4;
156156
if (args.size() < needed) {
157-
return std::make_unique<ErrorResult>("Test Start needs " + std::to_string(needed) +
158-
" arguments, found " + std::to_string(args.size()));
157+
// Built by appending rather than as one operator+ chain: GCC 12-14
158+
// cannot bound std::to_string() in a chain and mis-reports the
159+
// temporary's small-string buffer as overflowed (-Wstringop-overflow).
160+
std::string msg = "Test Start needs ";
161+
msg += std::to_string(needed);
162+
msg += " arguments, found ";
163+
msg += std::to_string(args.size());
164+
return std::make_unique<ErrorResult>(msg);
159165
}
160166
Json::Value config;
161167
config["enabled"] = 1;

0 commit comments

Comments
 (0)