kernc / logkeys

:memo: :keyboard: A GNU/Linux keylogger that works!
Other
748 stars 251 forks source link

Fix overflow #244

Open za3k opened 1 year ago

za3k commented 1 year ago

I believe this fixes issue #239, where args.flags was getting clobbered by an overflow

The problem was that sizeof(char_or_func) is 129, not 128, due to the trailing null byte.

However, I've tested logkeys on two computers, and on both I have unrelated keymap issues. Could someone please make sure this isn't breaking anything horribly before merging it? (ex. that I'm not chopping off a key?)

Fixes #239.

za3k commented 1 year ago

Nope, definitely this has some issues. Can you figure out the correct fix?

$ sudo logkeys --export-keymap=a.map
logkeys: ../../src/keytables.cc:43: bool logkeys::is_char_key(unsigned int): Assertion `code < sizeof(char_or_func)-1' failed.

Edit: I had a hard time figuring out if keycodes are 0-indexed or 1-indexed in the code

za3k commented 1 year ago

Best guess is that this works now. I think it was only an issue on keyboards with 128+ keys? Certainly I can't reproduce it on all machines.