]> git.ipfire.org Git - thirdparty/coreutils.git/commit
du,ls: don’t modify getenv strings
authorPaul Eggert <eggert@cs.ucla.edu>
Sun, 23 Nov 2025 19:42:57 +0000 (11:42 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Sun, 23 Nov 2025 20:00:09 +0000 (12:00 -0800)
commit2199c9003eafab7bab0f670d70e2869721e4813f
treecd2ae3883263b05e6d537bd7da538e1216b301ad
parenteade022f24d6596066516c52b0dbf7c692bec293
du,ls: don’t modify getenv strings

Fix du and ls to conform to the POSIX getenv spec,
which says you can’t modify strings returned by getenv
unless you put the string there directly, or used putenv.
This portability bug was found by strict C23 checking
using qualifier-generic functions.
* bootstrap.conf (gnulib_modules): Add xmemdup0.  Sort.
* src/du.c (main):
* src/ls.c (decode_switches):
Don’t modify the string that getenv returns.
Instead, use xmemdup0 if needed, and include xmemdup0.h.
NEWS
bootstrap.conf
src/du.c
src/ls.c