Public bug reported:

The slideshow saver shipped in xfce4-screensaver 4.20.1-1build1 (Ubuntu
26.04) overflows a heap buffer whenever it is started without --location,
which is how the packaged xfce-personal-slideshow.desktop starts it. In
normal use this shows up as an occasional SIGSEGV of
/usr/libexec/xfce4-screensaver/slideshow and an apport crash report.

Cause: savers/xdg-user-dir-lookup.c allocates only "$HOME/" with
g_strconcat() and then appends the rest of the XDG user directory path to
that buffer (regression from upstream commit 7968b781, 2023-05-20).

Upstream issue: https://gitlab.xfce.org/apps/xfce4-screensaver/-/issues/205
Upstream fix:   
https://gitlab.xfce.org/apps/xfce4-screensaver/-/merge_requests/70

The fix is a three-line change that restores the original allocation
size:

--- a/savers/xdg-user-dir-lookup.c
+++ b/savers/xdg-user-dir-lookup.c
@@
         if (relative) {
-            user_dir = g_strconcat (home_dir, "/", NULL);
+            user_dir = g_new0 (gchar, strlen (home_dir) + 1 + strlen (p) + 1);
+            strcpy (user_dir, home_dir);
+            strcat (user_dir, "/");
         } else {

Reproducer: select the "Slideshow" theme in the screensaver preferences with
the default XDG_PICTURES_DIR="$HOME/..." in ~/.config/user-dirs.dirs. With
LD_PRELOAD=libc_malloc_debug.so MALLOC_CHECK_=3 the saver aborts on every
start with "free(): invalid pointer" (g_free called from slideshow.c:126).

Workaround: start the saver with an explicit --location=<pictures
folder>.

** Affects: xfce4-screensaver (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2174069

Title:
  slideshow saver crashes: heap buffer overflow in xdg_user_dir_lookup()

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/xfce4-screensaver/+bug/2174069/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to