temperature_compensation: use snprintf instead of sprintf

because sprintf is deprecated on MacOS
and CI fails with warning -> error:

'sprintf' is deprecated: This function is
provided for compatibility reasons only.
Due to security concerns inherent in the
design of sprintf(3), it is highly
recommended that you use snprintf(3) instead.
This commit is contained in:
Matthias Grob 2023-07-20 10:16:37 +02:00
parent a37e3e7b06
commit 6889443bd7

View File

@ -212,7 +212,7 @@ int TemperatureCalibrationMag::finish_sensor_instance(PerSensorData &data, int s
for (unsigned axis_index = 0; axis_index < 3; axis_index++) {
for (unsigned coef_index = 0; coef_index <= 3; coef_index++) {
sprintf(str, "TC_M%d_X%d_%d", sensor_index, 3 - coef_index, axis_index);
snprintf(str, sizeof(str), "TC_M%d_X%d_%d", sensor_index, 3 - coef_index, axis_index);
param = (float)res[axis_index][coef_index];
result = param_set_no_notification(param_find(str), &param);