Skip to content

Commit b73dbc1

Browse files
authored
Merge pull request #358 from fzakaria/faridzakaria/off-by-one
print-interpreter: fix off by one error
2 parents fbf108f + b932eb8 commit b73dbc1

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,7 @@ Makefile
3232
/tests/libbig-dynstr.debug
3333
/tests/contiguous-note-sections
3434
/tests/simple-pie
35+
36+
.direnv/
37+
.vscode/
38+
.idea/

src/patchelf.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1237,7 +1237,7 @@ template<ElfFileParams>
12371237
std::string ElfFile<ElfFileParamNames>::getInterpreter()
12381238
{
12391239
auto shdr = findSection(".interp");
1240-
return std::string((char *) fileContents->data() + rdi(shdr.sh_offset), rdi(shdr.sh_size));
1240+
return std::string((char *) fileContents->data() + rdi(shdr.sh_offset), rdi(shdr.sh_size) - 1);
12411241
}
12421242

12431243
template<ElfFileParams>

0 commit comments

Comments
 (0)