diff --git a/changelog.upstream b/changelog.upstream index a637278..cbf733a 100644 --- a/changelog.upstream +++ b/changelog.upstream @@ -1,3 +1,150 @@ +commit 196343c1c614c9d35264c43e502c83477d7107e0 +Merge: 61c0b09 9cbdf44 +Author: Patrick Schleizer +Date: Mon Sep 25 11:56:55 2023 -0400 + + Merge remote-tracking branch 'vmonaco/master' + +commit 9cbdf4484da19eb09653356e59ce42c37cecb523 +Merge: 130d81b 2ed1b1f +Author: Vinnie Monaco +Date: Sun Sep 24 21:49:52 2023 -0700 + + Merge pull request #62 from skyzzuu/check_rescue_key_str_not_null + + ensure _rescue_keys_str is not null before passing to strncpy to avoid potential null pointer dereference + +commit 130d81b6e5f2c892fbd7596eaf1ad1f10911426e +Merge: af79b08 efa47d1 +Author: Vinnie Monaco +Date: Sun Sep 24 21:47:27 2023 -0700 + + Merge pull request #63 from vmonaco/dev + + update readme + +commit 61c0b09452ded9bcbd8476ee3aa103f116bc5330 +Author: Patrick Schleizer +Date: Sun Sep 24 11:22:09 2023 -0400 + + bumped changelog version + +commit 2ed1b1f4e1613d5add68e051fcd1d58fd1ef97e4 +Author: Everett Gally +Date: Sat Sep 23 11:25:33 2023 -0400 + + ensure _rescue_keys_str is not null before passing to strncpy to avoid potential null pointer dereference + +commit c107815a062251cef694a84cf0710a73168e2bcf +Merge: ca5cf50 af79b08 +Author: Patrick Schleizer +Date: Tue Sep 19 08:23:59 2023 -0400 + + Merge remote-tracking branch 'vmonaco/master' + +commit efa47d1e0fa7b3cea17491a9520276e408d07569 +Merge: f171889 c928a7c +Author: Vinnie Monaco +Date: Mon Sep 18 08:43:59 2023 -0700 + + Merge pull request #55 from skyzzuu/readme_changes + + add dependency installation information into readme + +commit af79b08ea3dd83b70c5099391ef3e1233b102511 +Merge: 8fb85a0 68c3c70 +Author: Vinnie Monaco +Date: Mon Sep 18 08:43:25 2023 -0700 + + Merge pull request #53 from adrelanos/indentation-style + + improve indentation style + +commit 68c3c7063d51afee6bee63c15ab2465d83591442 +Author: Patrick Schleizer +Date: Mon Sep 18 08:04:34 2023 -0400 + + improve indentation style + + fixes https://github.com/vmonaco/kloak/issues/52 + +commit ca5cf502265f24bfd871547739d8b86449d00bc1 +Author: Patrick Schleizer +Date: Mon Sep 18 07:23:20 2023 -0400 + + bumped changelog version + +commit f49d6b8d4575f1694fe5038a6639e04dca9d4bfb +Merge: 537dec7 8fb85a0 +Author: Patrick Schleizer +Date: Mon Sep 18 07:22:36 2023 -0400 + + Merge remote-tracking branch 'vmonaco/master' + +commit c928a7c52e2fa0b4f2b7e7cf49c94197555fb288 +Author: Everett Gally +Date: Mon Sep 18 07:16:55 2023 -0400 + + update debian dependency installation information to install devscripts and then use sudo mk-build-deps --remove --install instead of hardcoding dependencies + +commit 8fb85a065a809be2b504075c500cbd1d12c4ecd9 +Merge: d343f5e f55cecc +Author: Vinnie Monaco +Date: Sun Sep 17 21:16:31 2023 -0700 + + Merge pull request #57 from skyzzuu/avoid_mem_leak_after_exit + + free pfds after exit to avoid memory leak + +commit f55ceccf164a7a2705fd6151bad77e6c421cf9e0 +Author: Everett Gally +Date: Sun Sep 17 19:42:08 2023 -0400 + + free pfds after while loop in main_loop exits to avoid memory leak after kloak ends + +commit b2f3a2aae1b85e22f40868266927773307131d0d +Author: Everett Gally +Date: Sun Sep 10 17:13:52 2023 -0400 + + add dependency installation information into readme + +commit 537dec7423af4635f3fa15a730844a57538a8947 +Author: Patrick Schleizer +Date: Wed Aug 16 06:51:59 2023 -0400 + + bumped changelog version + +commit cc2e0c39482eafe88c9607c609c790a0266b1837 +Merge: 0a1abe0 d343f5e +Author: Patrick Schleizer +Date: Wed Aug 16 06:32:04 2023 -0400 + + Merge remote-tracking branch 'vmonaco/master' + +commit d343f5e41124ff32ee78badeee540dfdea59b8ac +Merge: 2a3a45b f171889 +Author: Vinnie Monaco +Date: Tue Aug 15 21:57:43 2023 -0700 + + Merge pull request #38 from vmonaco/dev + + Multi-device support and multiple bug fixes + +commit f1718890b1620ac6ba42f2e2d1a1c2c84730c8d4 +Merge: cda8d74 0a1abe0 +Author: Vinnie Monaco +Date: Tue Aug 15 21:57:15 2023 -0700 + + Merge pull request #49 from adrelanos/chatgpt + + chatgpt + +commit 0a1abe03dd873058cb3f2e83ce97a4ba1ad89ea1 +Author: Patrick Schleizer +Date: Tue Aug 15 09:21:16 2023 -0400 + + bumped changelog version + commit 59056a25d1e14d6d81ee8a9666eda0bc62fe342a Author: Patrick Schleizer Date: Tue Aug 15 09:19:43 2023 -0400 diff --git a/debian/changelog b/debian/changelog index 6543ad7..f99206e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,27 @@ +kloak (0:0.2.48-1) unstable; urgency=medium + + * New upstream version (local package). + + -- Patrick Schleizer Mon, 25 Sep 2023 15:58:40 +0000 + +kloak (0:0.2.47-1) unstable; urgency=medium + + * New upstream version (local package). + + -- Patrick Schleizer Sun, 24 Sep 2023 15:22:09 +0000 + +kloak (0:0.2.46-1) unstable; urgency=medium + + * New upstream version (local package). + + -- Patrick Schleizer Mon, 18 Sep 2023 11:23:20 +0000 + +kloak (0:0.2.45-1) unstable; urgency=medium + + * New upstream version (local package). + + -- Patrick Schleizer Wed, 16 Aug 2023 10:51:58 +0000 + kloak (0:0.2.44-1) unstable; urgency=medium * New upstream version (local package). diff --git a/src/main.c b/src/main.c index c8a9615..4cb43a1 100644 --- a/src/main.c +++ b/src/main.c @@ -72,7 +72,8 @@ void sleep_ms(long milliseconds) { struct timespec ts; ts.tv_sec = milliseconds / 1000; ts.tv_nsec = (milliseconds % 1000) * 1000000; - nanosleep(&ts, NULL); + if (nanosleep(&ts, NULL) == -1) + panic("nanosleep failed: %s", strerror(errno)); } long current_time_ms(void) { @@ -117,7 +118,8 @@ void set_rescue_keys(const char* rescue_keys_str) { int supports_event_type(int device_fd, int event_type) { unsigned long evbit = 0; // Get the bit field of available event types. - ioctl(device_fd, EVIOCGBIT(0, sizeof(evbit)), &evbit); + if (ioctl(device_fd, EVIOCGBIT(0, sizeof(evbit)), &evbit) == -1) + panic("ioctl EVIOCGBIT failed: %s", strerror(errno)); return evbit & (1 << event_type); } @@ -125,7 +127,8 @@ int supports_specific_key(int device_fd, unsigned int key) { size_t nchar = KEY_MAX/8 + 1; unsigned char bits[nchar]; // Get the bit fields of available keys. - ioctl(device_fd, EVIOCGBIT(EV_KEY, sizeof(bits)), &bits); + if (ioctl(device_fd, EVIOCGBIT(EV_KEY, sizeof(bits)), &bits) == -1) + panic("ioctl EVIOCGBIT for EV_KEY failed: %s", strerror(errno)); return bits[key/8] & (1 << (key % 8)); } @@ -155,7 +158,7 @@ void detect_devices() { char device[256]; for (int i = 0; i < MAX_DEVICES; i++) { - sprintf(device, "/dev/input/event%d", i); + snprintf(device, sizeof(device), "/dev/input/event%d", i); if ((fd = open(device, O_RDONLY)) < 0) { continue; @@ -163,15 +166,18 @@ void detect_devices() { if (is_keyboard(fd)) { strncpy(named_inputs[device_count++], device, BUFSIZE-1); + named_inputs[device_count - 1][BUFSIZE - 1] = '\0'; if (verbose) printf("Found keyboard at: %s\n", device); } else if (is_mouse(fd)) { strncpy(named_inputs[device_count++], device, BUFSIZE-1); + named_inputs[device_count - 1][BUFSIZE - 1] = '\0'; if (verbose) printf("Found mouse at: %s\n", device); } - close(fd); + if (close(fd) == -1) + panic("close failed on device: %s, error: %s", device, strerror(errno)); if (device_count >= MAX_INPUTS) { if (verbose) @@ -393,6 +399,7 @@ int main(int argc, char **argv) { if (device_count >= MAX_INPUTS) panic("Too many -r options: can read from at most %d devices\n", MAX_INPUTS); strncpy(named_inputs[device_count++], optarg, BUFSIZE-1); + named_inputs[device_count][BUFSIZE-1] = '\0'; break; case 'd': @@ -407,6 +414,7 @@ int main(int argc, char **argv) { case 'k': strncpy(rescue_keys_str, optarg, BUFSIZE-1); + rescue_keys_str[BUFSIZE-1] = '\0'; break; case 'v':