summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Göttsche <cgzones@googlemail.com>2023-02-21 19:41:07 +0100
committerChristian Göttsche <cgzones@googlemail.com>2023-02-21 19:41:07 +0100
commit00d1e82f2b1e415ec66d9aacb7e760d3ff617f02 (patch)
treed1c30875dee2e8b422f312abb7f0cdd5de03e582
parent28e95b30f3e7f1920a51a43ae275ec6f3508b495 (diff)
downloadpatchelf-00d1e82f2b1e415ec66d9aacb7e760d3ff617f02.tar.gz
Avoid implicit conversion
Use auto to avoid implicit type conversion, hiding possible value truncation.
-rw-r--r--src/patchelf.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/patchelf.cc b/src/patchelf.cc
index 08f0882..c10e369 100644
--- a/src/patchelf.cc
+++ b/src/patchelf.cc
@@ -290,11 +290,11 @@ ElfFile<ElfFileParamNames>::ElfFile(FileContents fContents)
/* Get the section header string table section (".shstrtab"). Its
index in the section header table is given by e_shstrndx field
of the ELF header. */
- unsigned int shstrtabIndex = rdi(hdr()->e_shstrndx);
+ auto shstrtabIndex = rdi(hdr()->e_shstrndx);
if (shstrtabIndex >= shdrs.size())
error("string table index out of bounds");
- unsigned int shstrtabSize = rdi(shdrs[shstrtabIndex].sh_size);
+ auto shstrtabSize = rdi(shdrs[shstrtabIndex].sh_size);
char * shstrtab = (char * ) fileContents->data() + rdi(shdrs[shstrtabIndex].sh_offset);
checkPointer(fileContents, shstrtab, shstrtabSize);