mirror of
https://github.com/libratbag/libratbag.git
synced 2026-11-07 15:14:38 +01:00
Correct index check in ratbag-command
When initializing N profiles they are indexed 0 to N-1. However, when setting the active profile to X the validation of X is a check for X > N. Notice that N is invalid as the maximum index is N-1. Change the validation check of the new active profile to X >= N. Signed-off-by: Palle Ravn <ravnzon@gmail.com>
This commit is contained in:
@@ -1457,7 +1457,7 @@ ratbag_cmd_profile_active_set(const struct ratbag_cmd *cmd,
|
||||
}
|
||||
|
||||
num_profiles = ratbag_device_get_num_profiles(device);
|
||||
if (index > num_profiles) {
|
||||
if (index >= num_profiles) {
|
||||
error("'%d' is not a valid profile\n", index);
|
||||
goto out;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user