1
0
forked from drath/libratbag

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:
Palle Ravn
2015-10-25 12:49:47 +01:00
parent 0726537a21
commit 61dc211e04

View File

@@ -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;
}