print-interpreter: fix off by one error #358
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix off by one error in the code that reads interpreter from the ELF file.
This was not evident when it was written directly to STDOUT but became problematic through my exploration of new functionality (#357) since there was an additional '\0' and the strings would not concatenate as a result.
> ./src/patchelf --print-interpreter /tmp/ruby /nix/store/563528481rvhc5kxwipjmg6rqrl95mdx-glibc-2.33-56/lib/ld-linux-x86-64.so.2
I would love to add a test here to demonstrate the additional '\0', if there is a TODO issue for a test suite please link this issue to it.
CC @Mic92