Commit Graph

60 Commits

Author SHA1 Message Date
z3rco
b39f88c6a2 Fix multiple security vulnerabilities across C, Python, and Go code
Timing-safe comparisons:
- crypto.c: Replace memcmp with CRYPTO_memcmp for Secret equality,
  require equal lengths before comparing
- remote_control.py: Constant-time password lookup to avoid leaking
  valid passwords via dict hash timing
- file_transmission.py: Use hmac.compare_digest for bypass token
  comparison instead of ==

Memory safety:
- child-monitor.c: Fix inverted condition in write_to_peer that
  prevented memmove from ever executing on partial writes
- ibus_glfw.c: Null-terminate IBUS_ADDRESS copy to prevent string
  overread when strlen >= PATH_MAX
- x11_window.c: Add NULL checks after realloc in clipboard/DnD
  data handling (two sites)
- dnd.c: Cap accepted_mimes at 1MB to prevent unbounded growth,
  fix realloc to not lose the original pointer on failure
- png-reader.c: Cast to size_t before multiplication to prevent
  integer overflow on 32-bit platforms

Secrets hygiene:
- disk-cache.c: Zero encryption_key with explicit_bzero before free

Tar extraction hardening:
- tar.go: Validate hardlink targets against destination prefix to
  prevent writing outside extraction directory
- tar.go: Strip setuid/setgid/sticky bits from extracted files

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 16:10:46 +01:00
Kovid Goyal
2fed0ec562 Linux: Handle desktop settings portals that are so old they don't implement ReadOne
Sigh, outdated Linux software, just creating busy work for everyone.
2025-05-08 15:22:42 +05:30
Kovid Goyal
61545a83e5 Fix #7982 2024-10-18 21:27:10 +05:30
Kovid Goyal
8fc96c5bd7 Make the debug logging functions consistent
They now all output the same format of:
[time since program start] msg
2024-04-08 12:53:55 +05:30
Kovid Goyal
f51c2f08a5 DRYer 2024-04-04 19:11:21 +05:30
Kovid Goyal
a7cbe3776d Wayland GNOME: Fix for ibus not working when using XWayland
See 8ce25208c3

I dont know what it is with GNOME. Every single release they break
backward compatibility somewhere, somehow. They must have special
talents.

Fixes #5967
2023-02-02 10:25:33 +05:30
Kovid Goyal
8280899ce1 IBUS: When creating the connection mark as focused if any top level window has focus. Fixes #5655 2022-11-10 07:21:34 +05:30
Kovid Goyal
b15c9f7419 Function should be static 2022-11-10 07:18:17 +05:30
Kovid Goyal
d1531632a2 Add some notes on how to run IBUS for testing 2022-01-26 10:47:18 +05:30
Kovid Goyal
2151969ae5 IBUS: Hide the pre-edit text when receiving a HidePreeditText message 2022-01-26 10:12:48 +05:30
Kovid Goyal
3728d2cfd9 Add changelog entry for previous PR 2021-09-29 19:43:33 +05:30
Park, Jeongmin
4232904055 ibus: Add support for ForwardKeyEvent signal
The ForwardKeyEvent ibus signal is used to maintain ordering between CommitText events and non-IME key events.
The ordering is important for Korean IMEs, where it automatically commits text whenever a character is fully composed. This is different from Chinese/Japanese IMEs, where user manually presses a key to commit each word.

Without this patch, kitty can't handle non-IME key events when used with ibus-hangul, which utilizes ForwardKeyEvent signal.

Without ForwardKeyEvent:
```
key | sequence of events from application's view
r   | UpdatePreeditText 'ㄱ'
k   | UpdatePreeditText '가'
1   | (receives the reply to ProcessKeyEvent call: "native_key: 0x31 release: 0 handled: 0")
    | -> UpdatePreeditText ''
    | -> CommitText '가'
```
Application receives "1가", which is incorrect.

With ForwardKeyEvent:
```
key | sequence of events from application's view
r   | UpdatePreeditText 'ㄱ'
k   | UpdatePreeditText '가'
1   | (receives the reply to ProcessKeyEvent call: "native_key: 0x31 release: 0 handled: 1", and kitty discards the event)
    | -> UpdatePreeditText ''
    | -> CommitText '가'
    | -> ForwardKeyEvent keysym=0x31("1")
```
Application receives "가1", which is correct.

Relevant ibus-hangul github issue to implement ForwardKeyEvent: https://github.com/libhangul/ibus-hangul/issues/42
Relevant changes in Qt to handle ForwardKeyEvent: https://codereview.qt-project.org/c/qt/qtbase/+/212179, https://codereview.qt-project.org/c/qt/qtbase/+/255587
2021-09-29 21:20:09 +09:00
Kovid Goyal
a038477ce0 Cleanup previous PR 2021-09-26 11:17:54 +05:30
unisgn
d078cb264a Update ibus_glfw.c 2021-09-25 00:10:53 +08:00
unisgn
c45a656153 ibus's dbus name owner changed detection
fcitx5 works fine with kitty, except that when you restart fcitx5, kitty stop working with fcitx5, because the dbus_connection_get_is_connected(ibus->conn) in #check_connection is always true when you use fcitx5.
this patch add a dbus name owner changed detection to detect the online status of ibus, in case the ibus backend uses the session bus, like fcitx5.
2021-09-24 23:10:38 +08:00
Kovid Goyal
be34af4555 Remove inline from .c files
It is ignored by compilers and hides unused static functions
2021-08-03 09:11:17 +05:30
Ravi R Kiran
b074533b29 Fix regression 2021-03-31 08:54:10 -05:00
Ravi R Kiran
953253de99 Implementation of hyper and meta 2021-03-30 14:23:17 -05:00
Kovid Goyal
84dcf8fd27 Use an enum for ime_state 2021-03-23 10:42:07 +05:30
Kovid Goyal
abc1e3f289 Remove the function used to init glfw key events
Instead use C99 struct initializers. Much less error prone.
2021-01-16 20:52:14 +05:30
Kovid Goyal
774a6c8c8b Remove glfw key constants 2021-01-16 20:52:12 +05:30
Weng Xuetian
b1387d50f0 Register to bus when connect to ibus.
This is required when the actual dbus is not from ibus but session bus.
This may happen when other run a shim layer for ibus, or ibus is
running with flatpak mode.
2020-07-31 17:54:10 -07:00
Benoit de Chezelles
7f2b98fad7 Rename all uses of 'scancode' to 'native_key' where relevant 2019-10-16 02:25:20 +02:00
Kovid Goyal
4ec1a8d9c3 Merge branch 'extract-glfw-key-event-data' of https://github.com/bew/kitty 2019-09-25 15:44:56 +05:30
Benoit de Chezelles
53275c9137 Extract key event data to struct 2019-09-24 19:15:35 +02:00
Luflosi
28bb123be8 Update the GLFW version number from 3.3 to 3.4
Closes https://github.com/kovidgoyal/kitty/issues/1884.
From a337c56848.
2019-08-02 11:00:16 -05:00
Kovid Goyal
841c907efc Build glfw with all warnings enabled 2019-07-01 10:42:07 +05:30
Kovid Goyal
0fafc07db0 Fix #1702 2019-06-11 15:30:50 +05:30
Kovid Goyal
47acc9ff2f Get rid of GLFW_(TRUE|FALSE) 2019-06-08 08:14:30 +05:30
Kovid Goyal
fe62700825 Get rid of GLFWbool 2019-06-08 08:12:42 +05:30
Luflosi
a653c17e8a Fix function returning the wrong type 2019-02-22 15:13:13 +01:00
Kovid Goyal
0fa12a687d Linux: Turn off IME unless the GLFW_IM_MODULE=ibus env var is set 2018-09-07 16:07:01 +05:30
Kovid Goyal
ddd8209c45 Fix crash when pressing enter while using IBUS 2018-08-06 10:35:46 +05:30
Kovid Goyal
cb289125ab Use _GNU_SOURCE instead of POSIX_SOURCE for fileno()
Maybe that will work with FreeBSD
2018-07-29 21:43:02 +05:30
Kovid Goyal
1ca49b9380 Fix #761 2018-07-29 12:15:21 +05:30
Kovid Goyal
97401f843a Sigh. Apparently _XOPEN_SOURCE is needed on older linux systems for fileno() 2018-07-28 23:54:23 +05:30
Kovid Goyal
02635d506e Dont use _XOPEN_SOURCE when building
Apparently it has exactly opposite semantics for glibc and whatever libcs
are used on BSD. What a clusterfuck.
2018-07-28 22:56:18 +05:30
Kovid Goyal
bd4831e2ee Some explicit includes needed for FreeBSD 2018-07-26 19:50:38 +05:30
Kovid Goyal
037bfeff82 Give IBUS a maximum of three seconds to respond to a key press
Previously was using the default timeout, which is 25 seconds
2018-07-12 18:18:21 +05:30
Kovid Goyal
98ede457a0 Do not hand on startup if the ibus daemon is hung 2018-07-12 18:18:21 +05:30
Kovid Goyal
6e9aecdff3 Fix Shift key not working with IBUS
Fixes #721
2018-07-12 18:18:20 +05:30
Kovid Goyal
95187632bf Allow using GLFW_IM_MODULE to activate ibus 2018-07-12 18:18:20 +05:30
Kovid Goyal
c6c6a18375 Handle keys returned by IBUS 2018-07-12 18:18:19 +05:30
Kovid Goyal
56063b283e Implement text commit from the IME system 2018-07-12 18:18:19 +05:30
Kovid Goyal
342164ede1 Add API for the application to notify the IME system of state changes 2018-07-12 18:18:19 +05:30
Kovid Goyal
377115a594 Add a GLFW specific env var to toggle IBUS 2018-07-12 18:18:19 +05:30
Kovid Goyal
e405b68da1 ... 2018-07-12 18:18:18 +05:30
Kovid Goyal
d875d7baed Implement the handler for ibus signals 2018-07-12 18:18:18 +05:30
Kovid Goyal
9c48e4965c Send key events to ibus 2018-07-12 18:18:18 +05:30
Kovid Goyal
8675659fcb Fix remaining sync BUS calls
Also work on IBUS integration
2018-07-12 18:18:18 +05:30