From 761b494a9f5ed9af8a5033acec862ea547cdf0bd Mon Sep 17 00:00:00 2001 From: Emery Hemingway Date: Fri, 20 May 2022 09:37:02 -0500 Subject: [PATCH] modifyRPath: return early if new and old rpath are empty --- src/patchelf.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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; }