Skip to content

Commit

Permalink
--set-soname: overwrite in place if it fits (NixOS#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
reidpr committed Sep 27, 2018
1 parent 27ffe8a commit 9a441a1
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/patchelf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1082,6 +1082,15 @@ void ElfFile<ElfFileParamNames>::modifySoname(sonameMode op, const std::string &

debug("new SONAME is '%s'\n", newSoname.c_str());

/* If new SONAME fits in existing space, overwrite. This works around
issue #44. */
if (newSoname.size() <= sonameSize) {
debug("overwriting old SONAME with new...\n");
strcpy(soname, newSoname.c_str());
changed = true;
return;
}

/* Grow the .dynstr section to make room for the new SONAME. */
debug("SONAME is too long, resizing...\n");

Expand Down

0 comments on commit 9a441a1

Please sign in to comment.