diff options
Diffstat (limited to 'utils/readsoname2.c')
-rw-r--r-- | utils/readsoname2.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/utils/readsoname2.c b/utils/readsoname2.c index 9452c0c4d..029a2bbc1 100644 --- a/utils/readsoname2.c +++ b/utils/readsoname2.c @@ -2,14 +2,14 @@ char *readsonameXX(char *name, FILE *infile, int expected_type, int *type) { ElfW(Ehdr) *epnt; ElfW(Phdr) *ppnt; - int i, j; + unsigned int i, j; char *header; - ElfW(Word) dynamic_addr = 0; - ElfW(Word) dynamic_size = 0; + ElfW(Addr) dynamic_addr = 0; + ElfW(Addr) dynamic_size = 0; unsigned long page_size = getpagesize(); - ElfW(Word) strtab_val = 0; - ElfW(Word) needed_val; - ElfW(Sword) loadaddr = -1; + ElfW(Addr) strtab_val = 0; + ElfW(Addr) needed_val; + ElfW(Addr) loadaddr = -1; ElfW(Dyn) *dpnt; struct stat st; char *needed; @@ -62,7 +62,7 @@ char *readsonameXX(char *name, FILE *infile, int expected_type, int *type) ppnt->p_filesz=bswap_32(ppnt->p_filesz); } - if (loadaddr == -1 && ppnt->p_type == PT_LOAD) + if (loadaddr == (ElfW(Addr))-1 && ppnt->p_type == PT_LOAD) loadaddr = (ppnt->p_vaddr & ~(page_size-1)) - (ppnt->p_offset & ~(page_size-1)); if(ppnt->p_type == 2) @@ -104,8 +104,8 @@ char *readsonameXX(char *name, FILE *infile, int expected_type, int *type) if (dpnt->d_tag == DT_SONAME || dpnt->d_tag == DT_NEEDED) { needed_val = dpnt->d_un.d_val; - if (needed_val + strtab_val - loadaddr >= 0 || - needed_val + strtab_val - loadaddr < st.st_size) + if (needed_val + strtab_val >= loadaddr || + needed_val + strtab_val < st.st_size - loadaddr) { needed = (char *) (header - loadaddr + strtab_val + needed_val); |