diff --git a/src/patchelf.cc b/src/patchelf.cc index f1eb11a..6882b28 100644 --- a/src/patchelf.cc +++ b/src/patchelf.cc @@ -1350,8 +1350,8 @@ void ElfFile::modifyRPath(RPathOp op, debug("new rpath is '%s'\n", newRPath.c_str()); - if (rpath && newRPath.size() <= rpathSize) { - memcpy(rpath, newRPath.c_str(), newRPath.size() + 1); + if (newRPath.size() <= rpathSize) { + if (rpath) memcpy(rpath, newRPath.c_str(), newRPath.size() + 1); return; }