pack: Add terminating zero after ‘readlink’ call.

The bug had been there from the start (commit
47a60325ca) 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
This commit is contained in:
Ludovic Courtès 2024-09-09 15:43:06 +02:00
parent 89fdc4b45f
commit cdb31a8869
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5

View file

@ -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". */