diff options
| author | Tobias Stoeckmann <tobias@stoeckmann.org> | 2024-09-12 20:52:15 +0200 |
|---|---|---|
| committer | Simon Ser <contact@emersion.fr> | 2025-06-08 16:16:09 +0000 |
| commit | ce0ac4f29e720688ea94fbe412a0b332304d8ee6 (patch) | |
| tree | 46d40d75de99cc5797a7f4d0b59652ee845190c7 | |
| parent | cursor: Fix undefined behavior with huge names (diff) | |
| download | wayland-ce0ac4f29e720688ea94fbe412a0b332304d8ee6.tar wayland-ce0ac4f29e720688ea94fbe412a0b332304d8ee6.tar.gz wayland-ce0ac4f29e720688ea94fbe412a0b332304d8ee6.tar.bz2 wayland-ce0ac4f29e720688ea94fbe412a0b332304d8ee6.tar.lz wayland-ce0ac4f29e720688ea94fbe412a0b332304d8ee6.tar.xz wayland-ce0ac4f29e720688ea94fbe412a0b332304d8ee6.tar.zst wayland-ce0ac4f29e720688ea94fbe412a0b332304d8ee6.zip | |
cursor: Gracefully handle out of memory condition
If the full path could not be constructed, avoid calling opendir(NULL)
which, depending on library, might trigger undefined behavior.
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
| -rw-r--r-- | cursor/xcursor.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/cursor/xcursor.c b/cursor/xcursor.c index b852a1f..f7156cd 100644 --- a/cursor/xcursor.c +++ b/cursor/xcursor.c @@ -686,11 +686,15 @@ load_all_cursors_from_dir(const char *path, int size, void *user_data) { FILE *f; - DIR *dir = opendir(path); + DIR *dir; struct dirent *ent; char *full; struct xcursor_images *images; + if (!path) + return; + + dir = opendir(path); if (!dir) return; |
