diff options
Diffstat (limited to 'test/uat-sensors.c')
-rw-r--r-- | test/uat-sensors.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/test/uat-sensors.c b/test/uat-sensors.c index efc9d6a..8a955ac 100644 --- a/test/uat-sensors.c +++ b/test/uat-sensors.c @@ -70,7 +70,8 @@ static unsigned int __sensor_type_to_bitmask(int idx) static bool __ua_monitor_foreach_sensor_cb(ua_sensor_e sensor, void *user_data) { const char *buf = uat_get_sensor_bitmask_str(sensor); - strncat(g_sensor_list_str, buf, strnlen(buf, MENU_DATA_SIZE)); + strncat(g_sensor_list_str, buf, + sizeof(g_sensor_list_str) - strlen(g_sensor_list_str) - 1); strncat(g_sensor_list_str, " ", 2); return TRUE; } @@ -94,7 +95,7 @@ static int run_ua_monitor_add_sensor( if (strlen(g_sensor_type)) { sensortype = (unsigned char)strtol(g_sensor_type, NULL, 10); - snprintf(g_sensor_type_str, MENU_DATA_SIZE, "%s", + snprintf(g_sensor_type_str, sizeof(g_sensor_type_str), "%s", uat_get_sensor_str(sensortype)); } @@ -122,7 +123,7 @@ static int run_ua_monitor_remove_sensor( if (strlen(g_sensor_type)) { sensortype = (unsigned char)strtol(g_sensor_type, NULL, 10); - snprintf(g_sensor_type_str, MENU_DATA_SIZE, "%s", + snprintf(g_sensor_type_str, sizeof(g_sensor_type_str), "%s", uat_get_sensor_str(sensortype)); } @@ -152,7 +153,7 @@ static int run_ua_monitor_is_sensor_available( if (strlen(g_sensor_type)) { sensortype = (unsigned char)strtol(g_sensor_type, NULL, 10); - snprintf(g_sensor_type_str, MENU_DATA_SIZE, "%s", + snprintf(g_sensor_type_str, sizeof(g_sensor_type_str), "%s", uat_get_sensor_str(sensortype)); } |