On Wed, Oct 28, 2026 at 12:14:29PM +0100, Matthieu Herrb wrote:
> On Wed, Oct 28, 2026 at 10:22:00AM +0100, Dirk-Wilhelm Peters wrote:
> > I have just found out by accident that xlock leaves its door slightly
> > ajar when using the marquee mode with a custom message:
> > 
> > xlock -mode marquee -message "hack me"
> > 
> > Simply type a few random characters to get back in.
> > 
> > Abort trap
> > 
> > This worked on several amd64 machines running 8.0 and 8.0-current.
> > 
> 
> This is a undefined behaviour of memcpy() on overlapping buffers. This
> patch should fix it.

I'm not a fan of memcpy aborting... I strongly suspect that everybody
else has a lenient memcpy (read: that behaves like memmove).

> None of the non default modes of xlock have been seriously audited for
> bugs like that. We still recommend to stick to -mode blank (the
> default).

At first I envisioned neutering -mode, but here's an even lazier diff.
>From a quick look I suspect that other modes are also affected but I'm
not volunteering to fix them, I only use -mode blank.

Thoughts?

Index: Makefile.bsd-wrapper
===================================================================
RCS file: /cvs/xenocara/app/xlockmore/Makefile.bsd-wrapper,v
diff -u -p -r1.15 Makefile.bsd-wrapper
--- Makefile.bsd-wrapper        26 Jun 2022 14:09:51 -0000      1.15
+++ Makefile.bsd-wrapper        28 Oct 2026 20:05:57 -0000
@@ -7,9 +7,9 @@ config.status:
        AUTOCONF_VERSION="$(AUTOCONF_VERSION)" \
        ACLOCAL="aclocal -I ${X11BASE}/share/aclocal" \
        CC="${CC}" \
-       CFLAGS="${CFLAGS}" \
+       CFLAGS="${CFLAGS} -Dmemcpy=memmove" \
        CXX="${CXX}" \
-       CXXFLAGS="${CXXFLAGS}" \
+       CXXFLAGS="${CXXFLAGS} -Dmemcpy=memmove" \
        PKG_CONFIG_PATH="$(PKG_CONFIG_PATH)" \
        CONFIG_SITE=$(CONFIG_SITE) \
                sh ${.CURDIR}/configure --prefix=${X11BASE} \

-- 
jca

Reply via email to