diff options
author | Chingis Dugarzhapov <chingis.dugarzhapov@amadeus.com> | 2014-04-10 16:37:50 (GMT) |
---|---|---|
committer | Chingis Dugarzhapov <chingis.dugarzhapov@amadeus.com> | 2014-04-10 16:37:50 (GMT) |
commit | b02d21f9b3926120249fefa9242ebcead94fc2dc (patch) | |
tree | 25ee1e5c900addbb2681b61b725ef72f305ab6ef /src | |
parent | 6f94890febd4369a89a69304c0eccf84eb1a0e03 (diff) | |
download | patchelf-b02d21f9b3926120249fefa9242ebcead94fc2dc.zip patchelf-b02d21f9b3926120249fefa9242ebcead94fc2dc.tar.gz patchelf-b02d21f9b3926120249fefa9242ebcead94fc2dc.tar.bz2 |
raise error if no DT_SONAME found
Diffstat (limited to 'src')
-rw-r--r-- | src/patchelf.cc | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/patchelf.cc b/src/patchelf.cc index a799407..c0fdfdd 100644 --- a/src/patchelf.cc +++ b/src/patchelf.cc @@ -894,7 +894,12 @@ string ElfFile<ElfFileParamNames>::getSoname() break; } } - return soname; + if (rdi(dynSoname->d_tag) == DT_NULL) { + error("Specified ELF file does not contain any DT_SONAME entry in .dynamic section!"); + } + else { + return soname; + } } template<ElfFileParams> @@ -913,6 +918,9 @@ void ElfFile<ElfFileParamNames>::setSoname(const string & newSoname) break; } } + if (rdi(dynSoname->d_tag) == DT_NULL) + error("Specified ELF file does not contain any DT_SONAME entry in .dynamic section!"); + if (newSoname.size() <= strlen(soname)) { debug("old soname: `%s', new soname: `%s'\n", soname, newSoname.c_str()); strcpy(soname, newSoname.c_str()); |