We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent aabc5b7 commit 3ab9005Copy full SHA for 3ab9005
src/modules/Telemetry/HostMetrics.cpp
@@ -111,7 +111,8 @@ meshtastic_Telemetry HostMetricsModule::getHostMetrics()
111
if (settingsStrings[hostMetrics_user_command] != "") {
112
std::string userCommandResult = exec(settingsStrings[hostMetrics_user_command].c_str());
113
if (userCommandResult.length() > 1) {
114
- strncpy(t.variant.host_metrics.user_string, userCommandResult.c_str(), 200);
+ strncpy(t.variant.host_metrics.user_string, userCommandResult.c_str(), sizeof(t.variant.host_metrics.user_string));
115
+ t.variant.host_metrics.user_string[ sizeof(t.variant.host_metrics.user_string) - 1] = '\0';
116
t.variant.host_metrics.has_user_string = true;
117
}
118
0 commit comments