fix(linux): fix memory problem

This fixes a problem identified by devin.ai: Because of the operator
precedence the previous code caused `memmove` to read
`sizeof(commit_queue_item) - 1` bytes past the end of `commit_queue`.
With this change `memmove` now reads the intended `MAX_QUEUE_SIZE - 1`
`commit_queue_items`.

Test-bot: skip
This commit is contained in:
Eberhard Beilharz 2026-04-07 15:13:55 +02:00
parent 0997cb826d
commit b765b55660
No known key found for this signature in database
GPG key ID: E9140597606020D3

View file

@ -782,7 +782,7 @@ commit_current_queue_item(IBusKeymanEngine *keyman) {
ibus_engine_forward_key_event(engine, current_item->keyval, current_item->keycode, current_item->state);
}
keyman->commit_item--;
memmove(keyman->commit_queue, &keyman->commit_queue[1], sizeof(commit_queue_item) * MAX_QUEUE_SIZE - 1);
memmove(keyman->commit_queue, &keyman->commit_queue[1], sizeof(commit_queue_item) * (MAX_QUEUE_SIZE - 1));
initialize_queue_items(keyman, MAX_QUEUE_SIZE - 1, 1);
}