mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-05-13 08:26:56 +00:00
Address code review: add buffer overflow safety in drop_append_request_keys
Agent-Logs-Url: https://github.com/kovidgoyal/kitty/sessions/cdeecb3c-8589-4622-8f6b-21b724e4d5fd Co-authored-by: kovidgoyal <1308621+kovidgoyal@users.noreply.github.com>
This commit is contained in:
parent
0f47a23c36
commit
3a8253e747
1 changed files with 3 additions and 3 deletions
|
|
@ -415,11 +415,11 @@ get_errno_name(int err) {
|
|||
static int
|
||||
drop_append_request_keys(Window *w, char *buf, size_t bufsize) {
|
||||
int sz = 0;
|
||||
if (w->drop.current_request_x)
|
||||
if (w->drop.current_request_x && sz < (int)bufsize - 1)
|
||||
sz += snprintf(buf + sz, bufsize - sz, ":x=%d", (int)w->drop.current_request_x);
|
||||
if (w->drop.current_request_y)
|
||||
if (w->drop.current_request_y && sz < (int)bufsize - 1)
|
||||
sz += snprintf(buf + sz, bufsize - sz, ":y=%d", (int)w->drop.current_request_y);
|
||||
if (w->drop.current_request_Y)
|
||||
if (w->drop.current_request_Y && sz < (int)bufsize - 1)
|
||||
sz += snprintf(buf + sz, bufsize - sz, ":Y=%d", (int)w->drop.current_request_Y);
|
||||
return sz;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue