aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Stoeckmann <tobias@stoeckmann.org>2024-09-12 22:18:30 +0200
committerSimon Ser <contact@emersion.fr>2025-06-08 16:16:09 +0000
commit2978fd701a6987668a4ff41f9434f6c0da705596 (patch)
tree76b0f721e85e2c4b950c65fcad5171b0aced7b6d
parentcursor: Gracefully handle huge cursor files (diff)
downloadwayland-2978fd701a6987668a4ff41f9434f6c0da705596.tar
wayland-2978fd701a6987668a4ff41f9434f6c0da705596.tar.gz
wayland-2978fd701a6987668a4ff41f9434f6c0da705596.tar.bz2
wayland-2978fd701a6987668a4ff41f9434f6c0da705596.tar.lz
wayland-2978fd701a6987668a4ff41f9434f6c0da705596.tar.xz
wayland-2978fd701a6987668a4ff41f9434f6c0da705596.tar.zst
wayland-2978fd701a6987668a4ff41f9434f6c0da705596.zip
cursor: Ignore invalid cursor files
The header offset must not be smaller than file header length. Ignore such invalid files. Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
-rw-r--r--cursor/xcursor.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/cursor/xcursor.c b/cursor/xcursor.c
index f7156cd..6e54cdb 100644
--- a/cursor/xcursor.c
+++ b/cursor/xcursor.c
@@ -259,6 +259,8 @@ xcursor_read_file_header(FILE *file)
return NULL;
if (!xcursor_read_uint(file, &head.ntoc))
return NULL;
+ if (head.header < XCURSOR_FILE_HEADER_LEN)
+ return NULL;
skip = head.header - XCURSOR_FILE_HEADER_LEN;
if (skip)
if (fseek(file, skip, SEEK_CUR) == EOF)