summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2025-06-23 13:31:17 -0400
committerIan Moffett <ian@osmora.org>2025-06-23 13:31:17 -0400
commit395fb7ac0dd57f9352a4001b4456095c47a63ef3 (patch)
treea14a006e2a0bb9f88593f21deeb265d904d59012 /usr.bin
parent8b6d02500abccb812e4e5d70a0d20cd1c83bad45 (diff)
usr.bin: kfgwm: Ensure x/y does not overflow
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/kfgwm/window.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/usr.bin/kfgwm/window.c b/usr.bin/kfgwm/window.c
index 0bc961b..8954553 100644
--- a/usr.bin/kfgwm/window.c
+++ b/usr.bin/kfgwm/window.c
@@ -77,6 +77,11 @@ draw_win(struct kfg_window *parent, struct kfg_window *wp)
x_end = x_i + wp->width;
y_end = y_i + wp->height;
+ if (x_end > parent->width)
+ x_end = parent->width;
+ if (y_end > parent->height)
+ y_end = parent->height;
+
for (kfgpos_t x = x_i; x < x_end; ++x) {
for (kfgpos_t y = y_i; y < y_i+KFG_TITLE_HEIGHT; ++y) {
rx = (x - x_i);