]> git.ipfire.org Git - thirdparty/lm-sensors.git/commitdiff
Makefile: do not use a temporary file to test iconv master
authorAurelien Jarno <aurelien@aurel32.net>
Fri, 24 Apr 2026 17:28:18 +0000 (19:28 +0200)
committerMichal Suchánek <hramrach@gmail.com>
Mon, 27 Apr 2026 07:36:53 +0000 (07:36 +0000)
Using a predictible temporary file name in /tmp is a security risk. It
could be used to overwrite or delete arbitrary files through a symlink,
possibly as root when running for instance "sudo make install".

Use "-o /dev/null" instead, which is supported by at least clang and
gcc.

Fixes: 68bda219526d
Makefile

index 2adae7081cfed5ed869a56c26fb8dbe37e4dc12a..1320407bd11cc8e7bddad19057fcb30d273a593f 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -177,15 +177,13 @@ ifndef LIBICONV
   ICONV_TEST := $(shell printf '%s\n' \
     '#include <iconv.h>' \
     'int main() { iconv_t cd = iconv_open("UTF-8", "ASCII"); return 0; }' \
   ICONV_TEST := $(shell printf '%s\n' \
     '#include <iconv.h>' \
     'int main() { iconv_t cd = iconv_open("UTF-8", "ASCII"); return 0; }' \
-    | $(CC) $(ALL_CPPFLAGS) -x c - -o /tmp/lm_sensors_iconv_test 2>/dev/null && echo "builtin" || echo "external")
+    | $(CC) $(ALL_CPPFLAGS) -x c - -o /dev/null 2>/dev/null && echo "builtin" || echo "external")
 
   ifeq ($(ICONV_TEST),builtin)
     LIBICONV :=
   else
     LIBICONV := -liconv
   endif
 
   ifeq ($(ICONV_TEST),builtin)
     LIBICONV :=
   else
     LIBICONV := -liconv
   endif
-
-  $(shell rm -f /tmp/lm_sensors_iconv_test)
 endif
 
 EXLDFLAGS := -Wl,-rpath,$(LIBDIR) $(ALL_LDFLAGS)
 endif
 
 EXLDFLAGS := -Wl,-rpath,$(LIBDIR) $(ALL_LDFLAGS)