From cdb31a8869d9faf6baf561836e99d7b6953aebe3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Mon, 9 Sep 2024 15:43:06 +0200 Subject: [PATCH] =?UTF-8?q?pack:=20Add=20terminating=20zero=20after=20?= =?UTF-8?q?=E2=80=98readlink=E2=80=99=20call.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The bug had been there from the start (commit 47a60325ca650e8fc1a291c8655b4297f4de8deb) but only with the switch to glibc 2.39 did we actually hit it. * gnu/packages/aux-files/run-in-namespace.c (main): Add terminating zero on SELF. Change-Id: If0488f5ca0964d8d7b1666039a7f8bdf7abce111 --- gnu/packages/aux-files/run-in-namespace.c | 1 + 1 file changed, 1 insertion(+) diff --git a/gnu/packages/aux-files/run-in-namespace.c b/gnu/packages/aux-files/run-in-namespace.c index 44c3c5a6cb..074befde46 100644 --- a/gnu/packages/aux-files/run-in-namespace.c +++ b/gnu/packages/aux-files/run-in-namespace.c @@ -652,6 +652,7 @@ main (int argc, char *argv[]) char self[PATH_MAX]; size = readlink ("/proc/self/exe", self, sizeof self - 1); assert (size > 0); + self[size] = '\0'; /* SELF is something like "/home/ludo/.local/gnu/store/…-foo/bin/ls" and we want to extract "/home/ludo/.local/gnu/store". */