Correct an indexing error that may leave stale data in the mousecfg buffer.
authorbru <bru@openbsd.org>
Wed, 25 Sep 2024 19:56:33 +0000 (19:56 +0000)
committerbru <bru@openbsd.org>
Wed, 25 Sep 2024 19:56:33 +0000 (19:56 +0000)
ok mpi@

sbin/wsconsctl/mousecfg.c

index 7fd7bff..3b9d0da 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: mousecfg.c,v 1.10 2023/07/02 21:44:04 bru Exp $ */
+/* $OpenBSD: mousecfg.c,v 1.11 2024/09/25 19:56:33 bru Exp $ */
 
 /*
  * Copyright (c) 2017 Ulf Brosziewski
@@ -222,8 +222,10 @@ mousecfg_put_field(int fd, struct wsmouse_parameters *field)
            || (err = ioctl(fd, WSMOUSEIO_GETPARAMS, field)))
                return err;
 
-       for (i = 0; i < field->nparams; i++)
+       for (i = 0; i < field->nparams; i++) {
+               n = index_of(field->params[i].key);
                cfg_buffer[n].value = field->params[i].value;
+       }
 
        return (0);
 }