[File] [patch] fix: use correct variable for ELF interpreter string
Vincent Mihalkovic
vmihalko at redhat.com
Tue May 20 10:49:44 UTC 2025
Hi,
I noticed that after commit 6bc6cf03ad4ad136088260e22f30c6d191c161a3
<https://github.com/file/file/commit/6bc6cf03ad4ad136088260e22f30c6d191c161a3>,
the ELF magic results have changed. Specifically, in the test data at
file-tests/db/elf <https://github.com/file/file-tests/tree/master/db/elf>,
the following difference occurs:
--- reference/elf/a.ref 2025-05-13 13:52:48.260986955 +0000
+++ /tmp/tmp.lcLqsYkBCU/out 2025-05-13 13:53:14.249232572 +0000
@@ -1 +1 @@
-ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked,
interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32,
BuildID[sha1]=f382d7105a1c1d2b42db80c4202ea7a84c59b335, not stripped
+ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked,
interpreter *empty*, for GNU/Linux 2.6.32,
BuildID[sha1]=f382d7105a1c1d2b42db80c4202ea7a84c59b335, not stripped
Upon reviewing the commit, I suspect a copy-paste mistake in the following
lines:
else
- strlcpy(interp, "*empty*", sizeof(interp));
+ str = "*empty*";
+ strlcpy(interp, "*empty*", sizeof(interp));
The strlcpy call should use the str variable as its source argument, not
the literal string "*empty*". The corrected code should be:
else
- strlcpy(interp, "*empty*", sizeof(interp));
+ str = "*empty*";
+ strlcpy(interp, str, sizeof(interp));
best regards,
Vincent Mihalkovic
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.astron.com/pipermail/file/attachments/20250520/93326dc9/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix-elf-interpreter-string.patch
Type: application/octet-stream
Size: 718 bytes
Desc: not available
URL: <https://mailman.astron.com/pipermail/file/attachments/20250520/93326dc9/attachment.obj>
More information about the File
mailing list