From 00d1e82f2b1e415ec66d9aacb7e760d3ff617f02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= Date: Tue, 21 Feb 2023 19:41:07 +0100 Subject: Avoid implicit conversion Use auto to avoid implicit type conversion, hiding possible value truncation. --- src/patchelf.cc | 4 ++-- 1 file 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::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); -- cgit v1.2.1