eviocgbit-buffer.patch 1002 B

12345678910111213141516171819202122232425
  1. Fix the buffer size passed to the EVIOCGBIT ioctl; patch provided by
  2. Sebastian Siewior, see
  3. http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=499414 and
  4. http://userweb.kernel.org/~dtor/eviocgbit-bug.html
  5. --- joystick-20051019.org/utils/evtest.c 2005-02-06 14:51:42.000000000 +0100
  6. +++ joystick-20051019/utils/evtest.c 2008-09-18 16:01:57.000000000 +0200
  7. @@ -333,14 +333,14 @@
  8. printf("Input device name: \"%s\"\n", name);
  9. memset(bit, 0, sizeof(bit));
  10. - ioctl(fd, EVIOCGBIT(0, EV_MAX), bit[0]);
  11. + ioctl(fd, EVIOCGBIT(0, sizeof(bit[0])), bit[0]);
  12. printf("Supported events:\n");
  13. for (i = 0; i < EV_MAX; i++)
  14. if (test_bit(i, bit[0])) {
  15. printf(" Event type %d (%s)\n", i, events[i] ? events[i] : "?");
  16. if (!i) continue;
  17. - ioctl(fd, EVIOCGBIT(i, KEY_MAX), bit[i]);
  18. + ioctl(fd, EVIOCGBIT(i, sizeof(bit[0])), bit[i]);
  19. for (j = 0; j < KEY_MAX; j++)
  20. if (test_bit(j, bit[i])) {
  21. printf(" Event code %d (%s)\n", j, names[i] ? (names[i][j] ? names[i][j] : "?") : "?");