diff options
author | Marvin Borner | 2021-03-21 12:40:41 +0100 |
---|---|---|
committer | Marvin Borner | 2021-03-21 12:46:08 +0100 |
commit | 09c3bdb186868204cb03d457244e05e12eb685d6 (patch) | |
tree | 7bf59794173d700df08ad303acd6c5a49193a9eb /libgui | |
parent | 68a0ad7f21ba07b93cd63613996e27afd8780f9c (diff) |
Hardened syscalls
Diffstat (limited to 'libgui')
-rw-r--r-- | libgui/gui.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/libgui/gui.c b/libgui/gui.c index e4800bc..9f0d39f 100644 --- a/libgui/gui.c +++ b/libgui/gui.c @@ -1,6 +1,7 @@ // MIT License, Copyright (c) 2021 Marvin Borner #include <def.h> +#include <errno.h> #include <gui.h> #include <msg.h> #include <print.h> @@ -15,7 +16,10 @@ s32 gui_new_window(struct gui_window *win) msg.header.type == (GUI_NEW_WINDOW | MSG_SUCCESS)) { win->id = msg.id; win->ctx = msg.ctx; - win->ctx.fb = shaccess(msg.shid); + u32 size; + res ret = shaccess(msg.shid, (u32 *)&win->ctx.fb, &size); + if (ret < 0 || !win->ctx.fb) + return MIN(ret, -1); return win->id; } return -1; |