[File] [patch] fix: use correct variable for ELF interpreter string
Christos Zoulas
christos at zoulas.com
Tue May 27 18:55:07 UTC 2025
Fixed, thanks!
christos
> On May 20, 2025, at 6:49 AM, Vincent Mihalkovic <vmihalko at redhat.com> wrote:
>
> 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
>
>
>
> <fix-elf-interpreter-string.patch>--
> File mailing list
> File at astron.com
> https://mailman.astron.com/mailman/listinfo/file
> <sanitizer.log>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.astron.com/pipermail/file/attachments/20250527/8195c4db/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 235 bytes
Desc: Message signed with OpenPGP
URL: <https://mailman.astron.com/pipermail/file/attachments/20250527/8195c4db/attachment.asc>
More information about the File
mailing list