diff options
author | Jörg Thalheim <joerg@thalheim.io> | 2021-09-12 10:26:13 +0200 |
---|---|---|
committer | Jörg Thalheim <joerg@thalheim.io> | 2021-09-12 10:27:01 +0200 |
commit | de3901853d49e7a607fc2bcdeb18e33875bce8ce (patch) | |
tree | 85ea3ef0b79943187d5cec93b6a5d794929c3b6b | |
parent | 57c3e7db502b0b5854df911d58cd34c5f5515233 (diff) | |
download | patchelf-de3901853d49e7a607fc2bcdeb18e33875bce8ce.tar.gz |
fix setting empty rpath
-rw-r--r-- | src/patchelf.cc | 2 | ||||
-rw-r--r-- | tests/Makefile.am | 3 | ||||
-rwxr-xr-x | tests/set-empty-rpath.sh | 11 |
3 files changed, 14 insertions, 2 deletions
diff --git a/src/patchelf.cc b/src/patchelf.cc index 246496d..4cc5e18 100644 --- a/src/patchelf.cc +++ b/src/patchelf.cc @@ -1500,7 +1500,7 @@ void ElfFile<ElfFileParamNames>::modifyRPath(RPathOp op, debug("new rpath is '%s'\n", newRPath.c_str()); - if (newRPath.size() <= rpathSize) { + if (rpath && newRPath.size() <= rpathSize) { memcpy(rpath, newRPath.c_str(), newRPath.size() + 1); return; } diff --git a/tests/Makefile.am b/tests/Makefile.am index 38438b8..135ae4f 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -37,7 +37,8 @@ src_TESTS = \ no-gnu-hash.sh \ no-dynamic-section.sh \ args-from-file.sh \ - basic-flags.sh + basic-flags.sh \ + set-empty-rpath.sh build_TESTS = \ $(no_rpath_arch_TESTS) diff --git a/tests/set-empty-rpath.sh b/tests/set-empty-rpath.sh new file mode 100755 index 0000000..de846a2 --- /dev/null +++ b/tests/set-empty-rpath.sh @@ -0,0 +1,11 @@ +#! /bin/sh -e +SCRATCH=scratch/$(basename $0 .sh) + +rm -rf ${SCRATCH} +mkdir -p ${SCRATCH} + +cp simple ${SCRATCH}/simple + +../src/patchelf --force-rpath --set-rpath "" ${SCRATCH}/simple + +${SCRATCH}/simple |